GNOME Bugzilla – Bug 778705
Don't crash when marshalling an unsafe integer from introspection
Last modified: 2017-02-25 06:00:39 UTC
The following crashes, at least in SpiderMonkey debug mode: gjs> const GLib = imports.gi.GLib; gjs> GLib.MAXINT64 Assertion failure: T(double(t)) == t (value creation would be lossy), at /blah/include/mozjs-38/js/Value.h:1596 Segmentation fault (core dumped) When marshalling 64-bit values from gobject introspection, we should check for this, and perhaps emit a warning to the developer.
Created attachment 346614 [details] [review] arg: Warn on lossy conversion from (u)int64 Previously, a conversion from 64-bit integer that could not be stored exactly in a double, would trip an assertion in debug mode SpiderMonkey. This new behaviour in SpiderMonkey 38 would cause code like "GLib.MAXINT64" to crash. Instead, we check for that situation, log a warning for the developer, and proceed with the lossy value.
Review of attachment 346614 [details] [review]: Looks good.
Attachment 346614 [details] pushed as 048fcee - arg: Warn on lossy conversion from (u)int64