-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
xplat: enforce TypedArray bound check in AsmJs #1703
Conversation
@MikeHolman Could you please help review? |
@@ -159,6 +159,11 @@ AsmJsJITInfo::UsesHeapBuffer() const | |||
bool | |||
AsmJsJITInfo::AccessNeedsBoundCheck(uint offset) const | |||
{ | |||
#ifdef _WIN32 | |||
// Normally, heap has min size of 0x10000, but if you use ChangeHeap, min heap size is increased to 0x1000000 | |||
return offset >= 0x1000000 || (IsHeapBufferConst() && offset >= 0x10000); |
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.
There is runtime guarantee that any access less than this is in bounds, so don't need to exclude this from xplat
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.
Will revert this. (Looks I originally added this when my problem was the other piece not emitting bound check.)
@@ -1152,7 +1157,10 @@ LowererMDArch::LowerAsmJsLdElemHelper(IR::Instr * instr, bool isSimdLoad /*= fal | |||
} | |||
Lowerer::InsertBranch(Js::OpCode::Br, loadLabel, helperLabel); | |||
|
|||
lowererMD->m_lowerer->GenerateRuntimeError(loadLabel, JSERR_ArgumentOutOfRange, IR::HelperOp_RuntimeRangeError); | |||
if (isSimdLoad) |
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.
else, you should move 0 into dst.
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.
Good catch, adding.
@MikeHolman Updated, thanks! |
For xplat always do bound check for Ld/St TypedArray in AsmJs. Currently we don't support out of bound access violation recovery on non _WIN32.
For xplat, always do bound check for Ld/St TypedArray in AsmJs. Currently
we don't support out of bound access violation recovery on non _WIN32.