GraphicsMagick: coders/tga.c 32 bit TGA colormap is expected to ...
GraphicsMagick Commits <[email protected]> Tue, 20 Feb 2024 17:20:06 -0600
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.13026.1708471222.16032.graphicsmagick-commit@lists.sourceforge.net> |
changeset 579fe3980299 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=579fe3980299 summary: coders/tga.c 32 bit TGA colormap is expected to have a valid alpha channel. diffstat: ChangeLog | 5 +++++ coders/tga.c | 18 +++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diffs (46 lines): diff -r 144f38e52d87 -r 579fe3980299 ChangeLog --- a/ChangeLog Tue Feb 20 17:11:58 2024 -0600 +++ b/ChangeLog Wed Feb 21 00:19:45 2024 +0100 @@ -1,3 +1,8 @@ +2024-02-21 Fojtik Jaroslav <[email protected]> + + * coders/tga.c 32 bit TGA colormap is expected to have a valid + alpha channel. + 2024-02-20 Fojtik Jaroslav <[email protected]> * coders/tga.c: TGA reader seems to ignore image orientation, diff -r 144f38e52d87 -r 579fe3980299 coders/tga.c --- a/coders/tga.c Tue Feb 20 17:11:58 2024 -0600 +++ b/coders/tga.c Wed Feb 21 00:19:45 2024 +0100 @@ -653,19 +653,23 @@ pixel.blue = ScaleCharToQuantum(ScaleColor5to8(pixel.blue)); break; } - case 24: - case 32: /* TODO: J.Fojtik - is this true? 32 bits, but only 24 bits read. Possible bug! */ - { - /* - 8 bits each of blue, green and red. - */ + + case 24: /* 8 bits each of blue, green and red. */ if (ReadBlob(image, 3, readbuffer) != 3) ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image); pixel.blue = ScaleCharToQuantum(readbuffer[0]); pixel.green = ScaleCharToQuantum(readbuffer[1]); pixel.red = ScaleCharToQuantum(readbuffer[2]); break; - } + + case 32: /* 8 bits each of blue, green and red + alpha. */ + if (ReadBlob(image, 4, readbuffer) != 4) + ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image); + pixel.blue = ScaleCharToQuantum(readbuffer[0]); + pixel.green = ScaleCharToQuantum(readbuffer[1]); + pixel.red = ScaleCharToQuantum(readbuffer[2]); + pixel.opacity = ScaleCharToQuantum(readbuffer[3]); + break; } image->colormap[i]=pixel; }