-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
lib,src: reset zero fill flag on exception #7093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Exceptions thrown from the Uint8Array constructor would leave it
disabled.
Regression introduced in commit 27e84dd ("lib,src: clean up
ArrayBufferAllocator") from two days ago. A follow-up commit
will add a regression test.
PR-URL: #7093
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -973,8 +973,8 @@ Local<Value> WinapiErrnoException(Isolate* isolate, | |
| void* ArrayBufferAllocator::Allocate(size_t size) { | ||
| if (zero_fill_field_ || zero_fill_all_buffers) | ||
| return calloc(size, 1); | ||
| zero_fill_field_ = 1; | ||
| return malloc(size); | ||
| else | ||
| return malloc(size); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't we just reset zero-flag here instead of delegating to JS side, right before the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was my initial implementation. Problem is if
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure of that. try-finally also checks that no non-failing shortcuts (that return an empty array) result in the flag not being reset. Do you have an example that passes the tests here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ChALkeR Are you addressing my comment? I'm saying I reset the bit in C++ and I believe you were the one that realized the bit can be flipped and remain flipped if the allocation fails.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @trevnorris No, somewhy I didn't see your comment and was adressing @RReverser comment. |
||
| } | ||
|
|
||
| static bool DomainHasErrorHandler(const Environment* env, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is an extra
ifneeded here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Needed', no, but I added it for symmetry with the check above and because it saves a bounds check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis Ah, that makes sense. Thanks!