This is a patch and long-winded README for the targa file format plugin (tga.c). It simply checks the value of the extension area offset before reading it from file. An offset value of 0 means that no extension area exists in the file. The area should not be read in this case otherwise it will cause problems (read: crash) on files that are smaller than the 495 bytes of the extension area (of a version 2.0 targa file). Steve
Attachment:
gimp-sgoodwin-010918-0.patch.gz
Description: Binary data
README for gimp-sgoodwin-010918-0.patch This patch fixes a bug with the tga loader (tga.c) reading small files. The extension area described in version 2.0 of the specification is optional. If the targa file does not have an extension area, the extension area offset (as given in the footer) has a value of 0. Because the current code does not check the value of the extension area offset, when the offset is 0 it reads in the the first 495 bytes of the file regardless (this is the fixed length portion of a spec 2.0 targa file). This causes problems when the file size is less than 495 bytes. Two obvious solutions are (1) check the value of the offset, and don't read the extension area if 0, alternatively (2) remove the code so the extension area is never read (because it is not used). This simple patch does (1). - Steve <steve@xxxxxxxxxxxxxxxxxxxx>