copy-structure broken with dx structs
Bug #911027 reported by
James Y Knight
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
copy-structure (and thus the default copied from defstruct) uses %instance-length to determine the length of the structure to copy.
But %instance-length is rounded up to a multiple of 2-minus-1 by dd-instance-length so that alignment works right, so some structs have an extra word of padding on the end.
DX-allocated structs don't pre-initialize the memory used, and so the padding word is filled with garbage. Garbage on the stack is okay (at least on x86/x86-64), so no problem.
But then, copy-structure copies the word of garbage to the heap. And next time there's a GC...BOOM.
I've attached the obvious patch to copy-structure.
Changed in sbcl: | |
status: | New → Fix Committed |
To post a comment you must log in.
commit 55577e881cb26ef 6001ff3ac3b2fdc 90f656c6ca
Author: Martin Cracauer <email address hidden>
Date: Fri Mar 23 13:39:54 2012 -0400
Closes https:/ /bugs.launchpad .net/sbcl/ +bug/911027
Fix copy-structure. When copying from stack to heap, garbage could
end up in the heap making GC unhappy. Thanks to James Knight.