Menu

#41 Invalid Memo read

Bugs in current CVS
open
nobody
general (14)
5
2011-12-03
2011-12-03
No

There is a bug in the xbDbf::GetMemoField which prevents reading a memo entry which does not hold in a single block.

The problem is cause by the fact that a call to GetMemoFieldLen is performed after the initial call to ReadMemoBlock. The GetMemoFieldLen function sequentially loads all blocks used for the current entry and so, when leaving this function, the currently loaded block is the last one. So, when we extract the data from the blocks, the content of the first block is replaced by the content of the last block and after, everything else is propery read.

A simple solution to solve this problem consists in calling GetMemoFieldLen before the first ReadMemoBlock.

Note that this solution is not really efficient as the blocks are loaded twice for 1 field load. As the user needs to know the size of the field before loading it, he shall perform a call to GetMemoFieldLen before loading the field, which means that the blocks are loaded 3 times for a field load.

Regards,

Brice André

Discussion


Log in to post a comment.