GFLSDK v2.54 memory overwrite bug???

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

Moderators: XnTriq, xnview

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

GFLSDK v2.54 memory overwrite bug???

Post by pepak » Mon Dec 18, 2006 3:11 pm

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
Contact:

Post by Grincheux » Thu Dec 28, 2006 9:59 am

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: 32055
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview » Wed Jan 24, 2007 9:40 am

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.

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post by MaierMan » Thu Feb 01, 2007 6:40 pm

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

User avatar
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post by MaierMan » Thu Feb 01, 2007 6:47 pm

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 » Sat Feb 24, 2007 8:49 am

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

Post Reply