Error loading progressive JPEGs in Windows
Original Reporter info from Mantis: Galfar
-
Reporter name: Marek Mauder (Galfar)
Original Reporter info from Mantis: Galfar
- Reporter name: Marek Mauder (Galfar)
Description:
Wrong sizes are calculated during memory allocation
for progressive JPEGs.
In jmemmgr unit in alloc_barray there is:
ltemp := (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) div
(long(blocksperrow) * SIZEOF(JBLOCK));
if (ltemp <= 0) then
ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
Now in jmemnobs unit there is:
{$IFDEF WINDOWS}
const
MAX_ALLOC_CHUNK = long(32752);
{$ELSE}
const
MAX_ALLOC_CHUNK = long(1000000000);
{$ENDIF}
FPC defines WINDOWS symbol and MAX_ALLOC_CHUNK is too small resulting in
ltemp in alloc_barray being always 0. No progressive JPEG is loaded corectly then.
Additional information:
It works well in FPC in Unix and in current Delphis.
Also it worked in older FPC (worked in 2.0.2 broken in 2.0.4, not 100% sure though).
Mantis conversion info:
- Mantis ID: 12535
- Version: 2.2.2
- Fixed in version: 2.6.0
- Target version: 2.5.1