• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by Galfar
 - 31 October 2008, 13:15:36
Found the problem!

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);

ERREXIT calls JpegError in ImagingJpeg.pas which should stop further loading.
Since JpegError is empty it continues to mem allocation code.
But it only happens in FPC in Windows, not FPC Linux or Delphi.
Then I noticed this in jmemnobs.pas unit:

{$IFDEF WINDOWS}
const
  MAX_ALLOC_CHUNK = long(32752);
{$ELSE}
const
  MAX_ALLOC_CHUNK = long(1000000000);
{$ENDIF}

WINDOWS symbol is defined in FPC Win32 and MAX_ALLOC_CHUNK is too small
so ltemp is zero and error gets raised.

Fix is easy but problem is here: ImagingJpeg uses PasJpeg in FPC instead of
my modified JpegLib version present in Imaging. So it will have to be disabled -
Imaging compiled using FPC in Windows will use Imaging's JpegLib.
Posted by bungarus
 - 25 October 2008, 14:36:54
Ok, I got your tips.

Imagelib 0.26.0
Compiler FPC 2.2.0
OS MS Vista Home SP1

Attached an image causing error. Saved with Adobe Photoshop Elements 5.0.

Anyway, nice lib. Thanks.
Posted by Galfar
 - 22 October 2008, 23:56:33
Could you please attach here some of the jpegs that cause this error?
I know there are some problems with progressive jpegs.
Posted by bungarus
 - 19 October 2008, 18:33:09
Hi,

loading some types of jpeg image in function alloc_barray the
calculation of max # of rows allowed in one allocation chunk gets 0.
This causes call of ERREXIT in line 496, which should stop operation
but original ImagingJpeg.pas has empty JpegError procedure body so
operation doesn't stop.
Host sucks on high memory allocation.
Of course you get an out of memory message later, but you can't load any image longer.


See attached image.

regards
SMF spam blocked by CleanTalk