Embedded ICC profiles can cause the size of a JPEG file to exceed the
size returned by tjBufSize() (which is really meant to be used for
compression anyhow, not for decompression), and this was causing a
segfault (C) or an ArrayIndexOutOfBoundsException (Java) when
decompressing such files with TJBench. This commit modifies the
benchmark such that, when tiled decompression is disabled, it re-uses
the source buffer as the primary JPEG buffer.
/*
- * Copyright (C)2009-2014, 2016 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2009-2014, 2016-2017 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
System.out.print("N/A N/A ");
jpegBuf = new byte[1][TJ.bufSize(_tilew, _tileh, subsamp)];
jpegSize = new int[1];
+ jpegBuf[0] = srcBuf;
jpegSize[0] = srcSize;
- System.arraycopy(srcBuf, 0, jpegBuf[0], 0, srcSize);
}
if (w == tilew)
/*
- * Copyright (C)2009-2016 D. R. Commander. All Rights Reserved.
+ * Copyright (C)2009-2017 D. R. Commander. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
{
if(quiet==1) printf("N/A N/A ");
jpegsize[0]=srcsize;
- memcpy(jpegbuf[0], srcbuf, srcsize);
+ free(jpegbuf[0]);
+ jpegbuf[0]=srcbuf;
+ srcbuf=NULL;
}
if(w==tilew) _tilew=_w;