News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

HeapAlloc boundary issue with variablelength records ??

Started by mikeburr, April 22, 2019, 09:08:34 PM

Previous topic - Next topic

mikeburr

i wonder if anyone has experienced a problem with Heap Allocation using Variable length records.
the code is something like HeapAlloc,handle,Heap Zero Memory, length of data...
this would probably usually be used with a data mask or structure eg sizeof Some data structure
Generally This work fine
but failed rather oddly one one data length
I have a data header of N bytes followed by variable length data , 
and when N+data = 16 bytes [ie fell on some sort of boundary the allocation bombed ... i tried multiples of 16 + data length eg header = 12... data lengths 4,20,36,etc but strangely
this didnt fail ...
also it might be a first time issue in the operating system as i recall[though i cant be sure now !!]  it didnt do this if the second item fell on a boundary
to resolve the issue
i added a byte to the estimated length, as if it had a terminating zero, and didnt get the problem subsequently with any data length
[i should add that the data is irrelevant in this discussion where it is processed as hex ]
i didnt have the time to use Olly to see just where this was occurring in the op sys but will prob do so at some point .. regards mike b

jj2007

Post complete code, and we'll show you where the bug is 8)

mikeburr

no point jj theres no bug in the code its in the heap allocation
regards mike b 

jj2007

Do you seriously think HeapAlloc is buggy? Do you have a vague idea how many Millions of lines of code use HeapAlloc?


hutch--

> no point jj theres no bug in the code its in the heap allocation

It has been ,my experience that such claims end up being a bug in the code rather than the API function that was used in the code. If you think you have found a bug in the API function you would report it to Microsoft with a "please fix" note complete with a working example but as you have said that you don't have the time to debug it yourself and the problem in your code is so badly described, I don't see how anyone can help you.

Tedd

Post a working example so this 'bug' can be confirmed (or refuted.)
Potato2