[webkit-reviews] review granted: [Bug 210865] [JSC] Add JSBigInt::validate to ensure produced JSBigInt meets its invariant : [Attachment 397292] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Apr 22 20:49:17 PDT 2020
Keith Miller <keith_miller at apple.com> has granted Yusuke Suzuki
<ysuzuki at apple.com>'s request for review:
Bug 210865: [JSC] Add JSBigInt::validate to ensure produced JSBigInt meets its
invariant
https://bugs.webkit.org/show_bug.cgi?id=210865
Attachment 397292: Patch
https://bugs.webkit.org/attachment.cgi?id=397292&action=review
--- Comment #2 from Keith Miller <keith_miller at apple.com> ---
Comment on attachment 397292
--> https://bugs.webkit.org/attachment.cgi?id=397292
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=397292&action=review
r=me.
> Source/JavaScriptCore/ChangeLog:9
> + Wrap public facing JSBigInt functions with `validate([&] { })` to
validate the generated JSBigInt meets the invariant
> + to catch bugs like r260522.
Can't say I'm a huge fan of this style... Is there any way we can do it with a
ScopeExit type thing? I can't think of anything right now but I could be
missing something.
> Source/JavaScriptCore/runtime/JSBigInt.h:302
> + if (bigInt) {
> + if (bigInt->length() == 0)
> + ASSERT(!bigInt->sign());
> + else
> + ASSERT(bigInt->digit(bigInt->length() - 1));
> + }
> + return bigInt;
Is it possible to vend HeapBigInts for 32-bit values? If not, should we assert
that here?
More information about the webkit-reviews
mailing list