Closed
Bug 682504
Opened 14 years ago
Closed 14 years ago
js-ctypes doesn't handle void callbacks
Categories
(Core :: js-ctypes, defect)
Core
js-ctypes
Tracking
()
RESOLVED
FIXED
mozilla10
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(2 files, 3 obsolete files)
1.13 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
1.35 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
We check the void case here: http://hg.mozilla.org/mozilla-central/file/906413a7ae6b/js/src/ctypes/CTypes.cpp#l5365
After that though, we still call ImplicitConvert unconditionally: http://hg.mozilla.org/mozilla-central/file/906413a7ae6b/js/src/ctypes/CTypes.cpp#l5414
The first thing we do within ImplicitConvert is assert IsSizeDefined() on the target type. This is false for a void return value.
Patch and test coverage coming right up.
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → bobbyholley+bmo
Assignee | ||
Comment 1•14 years ago
|
||
Attached a patch. Flagging dwitte for review.
Attachment #556211 -
Flags: review?(dwitte)
Assignee | ||
Comment 2•14 years ago
|
||
Attached tests. Flagging jorendorff for review.
Attachment #556212 -
Flags: review?(jorendorff)
Comment 3•14 years ago
|
||
Comment on attachment 556211 [details] [diff] [review]
Don't try to ImplicitConvert a void return value. v1
Stealing review. This is correct (but should not land without the tests of course).
Attachment #556211 -
Flags: review?(dwitte) → review+
Comment 4•14 years ago
|
||
Comment on attachment 556212 [details] [diff] [review]
Tests. v1
I guess there is no such thing as a bad test, but note that this can be tested without touching the C++ library. The simplest test is like this:
var fnptr_t = ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, []).ptr;
fnptr_t(function () {})(); // don't crash
It crashes without the patch. I can't overstate how nice it is to have small tests--so please add a test with just this in it, if you can do that.
Otherwise r=me. Thanks.
Attachment #556212 -
Flags: review?(jorendorff) → review+
Assignee | ||
Comment 5•14 years ago
|
||
> The simplest test is like this:
Ah, good idea! Attaching an updated patch and carrying over review.
Attachment #556212 -
Attachment is obsolete: true
Attachment #556617 -
Flags: review+
Assignee | ||
Comment 6•14 years ago
|
||
Whoops, small bug in my push-to-bugzilla script. Sorry for the bugspam.
Attachment #556617 -
Attachment is obsolete: true
Attachment #556619 -
Flags: review+
Assignee | ||
Comment 7•14 years ago
|
||
Still not quite right. This should do it.
Attachment #556619 -
Attachment is obsolete: true
Attachment #556622 -
Flags: review+
Assignee | ||
Comment 9•14 years ago
|
||
Pushed to mozilla-inbound: http://hg.mozilla.org/integration/mozilla-inbound/rev/f13920d33454
This had a green try run, modulo known oranges: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=e71f6e3a3771
Status: NEW → ASSIGNED
Flags: in-testsuite+
Assignee | ||
Updated•14 years ago
|
Target Milestone: --- → mozilla10
https://hg.mozilla.org/mozilla-central/rev/c5ed26ad5709
https://hg.mozilla.org/mozilla-central/rev/f13920d33454
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•