Closed Bug 920384 Opened 12 years ago Closed 12 years ago

assertNoOverlap should allow zero-length regions

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 917593

People

(Reporter: sfink, Assigned: sfink)

Details

Attachments

(1 file)

I made a modification to the structured clone algorithm that resulted in an assertion failure while trying to deserialize an empty string. The problem is that the previous allocation at that time was the clone buffer data itself, and I malloc'd 2 bytes (for a NUL that I supposedly might need) to hold the string data immediately after. I then tried to copy 0 bytes of data from end of the clone buffer to the beginning of my malloced buffer, and both of those were at the same pointer location. As a result, I ended up calling copyAndSwapFromLittleEndian with nelems=0. Endian.h's assertNoOverlap got very unhappy about this.
assertNoOverlap seems unnecessarily complicated, too, since the count is the same for both buffers and so you don't need to worry about the tricky cases. I switched to saying "the distance between the pointers must be at least the count". It uses abs(), though, and maybe that's verboten.
Attachment #809679 - Flags: review?(jwalden+bmo)
How is this different from bug 917593?
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
Attachment #809679 - Flags: review?(jwalden+bmo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: