tjLoadImage(): Fix OOB array access w/TJPF_UNKNOWN

Because the previous commit added a test for TJPF_UNKNOWN to tjunittest,
the ASAN CI build detected this issue.
This commit is contained in:
DRC
2017-11-19 09:18:36 -06:00
parent e817c07779
commit 9f1f86bf7f

View File

@@ -1987,7 +1987,8 @@ DLLEXPORT unsigned char* DLLCALL tjLoadImage(const char *filename, int *width,
retval=-1; goto bailout;
}
cinfo->in_color_space=pf2cs[*pixelFormat];
if(*pixelFormat==TJPF_UNKNOWN) cinfo->in_color_space=JCS_UNKNOWN;
else cinfo->in_color_space=pf2cs[*pixelFormat];
if(tempc=='B')
{
if((src=jinit_read_bmp(cinfo, FALSE))==NULL)