GFLSDK v2.54 memory overwrite bug???

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

pepak
Posts: 6
Joined: Wed Dec 13, 2006 3:37 pm

GFLSDK v2.54 memory overwrite bug???

Post by pepak »

I am having serious trouble writing a Delphi component descended from TGraphic with GflSDK 2.54. The application keeps crashing with an EAccessViolation. After numerous tests I noticed a probable culprit: When I call gflDefaultLoadParams(LoadParams), it writes not only 120 bytes (size of TGFL_LOAD_PARAMS structure) but 132 bytes, overwriting other variables!! Could someone verify this on his system, please?
User avatar
Grincheux
Posts: 33
Joined: Thu Nov 30, 2006 8:01 am
Location: Arbois - 39

Post by Grincheux »

I have found the same problem with GFL_SAVE_PARAMS.
I have added two bytes at the end of the structure to solve the problem.
In an other way you can pass a buffer of 1024 byte and cast it to use the structure definition.
Kenavo.
User avatar
xnview
Author of XnView
Posts: 44461
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Post by xnview »

Grincheux wrote:I have found the same problem with GFL_SAVE_PARAMS.
I have added two bytes at the end of the structure to solve the problem.
In an other way you can pass a buffer of 1024 byte and cast it to use the structure definition.
Ok, i'll check
Pierre.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm

Post by MaierMan »

Those 12 bits come from those 6 Camera members.
They are float (4-byte) but in Delphi UINT16 (2-byte).
6 * 2 = 12; 120 + 12 = 132

Make those five a "Single" and stuff will work again ;)
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm

Post by MaierMan »

TGFL_SAVE_PARAMS misses the UserParams:

Code: Select all

    ...
    UserParams: Pointer;
  end;
pepak
Posts: 6
Joined: Wed Dec 13, 2006 3:37 pm

Post by pepak »

Just for the record, the load params were fixed in version 2.66