cderror.h: Always include all img I/O err messages
The 8-bit-per-sample image I/O modules have always been built with BMP, GIF, PBMPLUS, and Targa support, and the 12-bit-per-sample image I/O modules have always been built with only GIF and PBMPLUS support. In libjpeg-turbo 2.1.x and prior, cjpeg and djpeg were built with the same image format support as the image I/O modules. However, because of the multi-precision feature introduced in libjpeg-turbo 3.0.x, cjpeg and djpeg are now always built with support for all image formats. Thus, the error message table compiled into cjpeg and djpeg was a superset of the error message table compiled into the 12-bit-per-sample and 16-bit-per-sample image I/O modules. If, for example, the 12-bit-per-sample PPM writer threw JERR_PPM_COLORSPACE (== 15, because it was built with only GIF and PBMPLUS support), then djpeg interpreted that as JERR_GIF_COLORSPACE (== 15, because it was built with support for all image formats.) There was no chance of a buffer overrun, since the error message table lookup was performed against the table compiled into cjpeg and djpeg, which contained all possible entries. However, this issue caused an incorrect error message to be displayed by cjpeg or djpeg if a 12-bit-per-sample or 16-bit-per-sample image I/O module threw an error. This commit simply removes the *_SUPPORTED #ifdefs from cderror.h so that all image I/O error messages are always included in every instance of the image I/O error message table. Note that a similar issue could have also occurred with the 12-bit-per-sample and 16-bit-per-sample TurboJPEG image I/O functions, since the 12-bit-per-sample and 16-bit-per-sample image I/O modules supporting those functions are built with only PBMPLUS support whereas the library as a whole is built with BMP and PBMPLUS support.
This commit is contained in:
@@ -42,7 +42,6 @@ typedef enum {
|
||||
|
||||
JMESSAGE(JMSG_FIRSTADDONCODE = 1000, NULL) /* Must be first entry! */
|
||||
|
||||
#ifdef BMP_SUPPORTED
|
||||
JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format")
|
||||
JMESSAGE(JERR_BMP_BADDEPTH, "Only 8-, 24-, and 32-bit BMP files are supported")
|
||||
JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length")
|
||||
@@ -56,9 +55,7 @@ JMESSAGE(JTRC_BMP, "%ux%u %d-bit BMP image")
|
||||
JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
|
||||
JMESSAGE(JTRC_BMP_OS2, "%ux%u %d-bit OS2 BMP image")
|
||||
JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image")
|
||||
#endif /* BMP_SUPPORTED */
|
||||
|
||||
#ifdef GIF_SUPPORTED
|
||||
JMESSAGE(JERR_GIF_BUG, "GIF output got confused")
|
||||
JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d")
|
||||
JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB")
|
||||
@@ -74,9 +71,7 @@ JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file")
|
||||
JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring")
|
||||
JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image")
|
||||
JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits")
|
||||
#endif /* GIF_SUPPORTED */
|
||||
|
||||
#ifdef PPM_SUPPORTED
|
||||
JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
|
||||
JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
|
||||
JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
|
||||
@@ -85,18 +80,14 @@ JMESSAGE(JTRC_PGM, "%ux%u PGM image")
|
||||
JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
|
||||
JMESSAGE(JTRC_PPM, "%ux%u PPM image")
|
||||
JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image")
|
||||
#endif /* PPM_SUPPORTED */
|
||||
|
||||
#ifdef TARGA_SUPPORTED
|
||||
JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format")
|
||||
JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file")
|
||||
JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB")
|
||||
JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image")
|
||||
JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image")
|
||||
JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image")
|
||||
#else
|
||||
JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled")
|
||||
#endif /* TARGA_SUPPORTED */
|
||||
|
||||
JMESSAGE(JERR_BAD_CMAP_FILE,
|
||||
"Color map file is invalid or of unsupported format")
|
||||
|
||||
Reference in New Issue
Block a user