Bug 163955

Summary: Explore increasing max JSString::m_length to UINT_MAX.
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Keith Miller <keith_miller>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, jfbastien, keith_miller, msaboff, saam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Mark Lam
Reported 2016-10-25 10:59:53 PDT
If there's no perf implications, we should increase max JSString::m_length to UINT_MAX to match the max StringImpl length.
Attachments
Patch (2.87 KB, patch)
2017-08-25 09:33 PDT, Keith Miller
no flags
Patch (2.90 KB, patch)
2017-08-25 09:36 PDT, Keith Miller
no flags
Keith Miller
Comment 1 2017-08-25 09:33:09 PDT
Keith Miller
Comment 2 2017-08-25 09:36:33 PDT
Keith Miller
Comment 3 2017-08-25 09:37:15 PDT
Keith Miller
Comment 4 2017-08-25 09:38:33 PDT
I'll watch the bots for perf changes. I doubt this should make a difference to perf
JF Bastien
Comment 5 2017-08-25 09:40:12 PDT
Comment on attachment 319085 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=319085&action=review What prevents size overflow without this check? Don't you want to check UINT_MAX instead of INT_MAX? > Source/JavaScriptCore/ChangeLog:3 > + Explore increasing max JSString::m_length to UINT_MAX. Weird to still be "exploring" here :)
JF Bastien
Comment 6 2017-08-25 09:43:36 PDT
Comment on attachment 319085 [details] Patch OK Keith pointed out that size_t is misleading because string's .length returns unsigned. The assumption I have now is that tryMakeString will fail on its own, so this patch is OK. Please confirm that's the case before committing. r=me if so. Maybe needs a test?
WebKit Commit Bot
Comment 7 2017-08-25 10:27:50 PDT
Comment on attachment 319085 [details] Patch Clearing flags on attachment: 319085 Committed r221192: <http://trac.webkit.org/changeset/221192>
WebKit Commit Bot
Comment 8 2017-08-25 10:27:52 PDT
All reviewed patches have been landed. Closing bug.
Geoffrey Garen
Comment 9 2017-08-25 13:18:54 PDT
I don't think this patch can be right. It deletes an ASSERT and a comment explaining a problem, but it doesn't fix the problem. Consider ThunkGenerators.cpp::stringCharLoad and similar functions: // load index jit.loadInt32Argument(0, SpecializedThunkJIT::regT1); // regT1 contains the index // Do an unsigned compare to simultaneously filter negative indices as well as indices that are too large jit.appendFailure(jit.branch32(MacroAssembler::AboveOrEqual, SpecializedThunkJIT::regT1, SpecializedThunkJIT::regT2)); ...
Keith Miller
Comment 10 2017-08-25 13:44:22 PDT
(In reply to Geoffrey Garen from comment #9) > I don't think this patch can be right. It deletes an ASSERT and a comment > explaining a problem, but it doesn't fix the problem. > > Consider ThunkGenerators.cpp::stringCharLoad and similar functions: > > // load index > jit.loadInt32Argument(0, SpecializedThunkJIT::regT1); // regT1 contains > the index > > // Do an unsigned compare to simultaneously filter negative indices as > well as indices that are too large > jit.appendFailure(jit.branch32(MacroAssembler::AboveOrEqual, > SpecializedThunkJIT::regT1, SpecializedThunkJIT::regT2)); > > ... I think this is fine. That thunk calls the slow path (the C++ code) if it fails that check. The C++ code does the right thing for positive offsets. It will only fail if the unsigned offset they are looking for is > 2GB, which is also exceedingly unlikely. It also doesn't seem like any of the other code does the wrong thing.
Saam Barati
Comment 11 2017-08-25 14:53:26 PDT
(In reply to Keith Miller from comment #10) > (In reply to Geoffrey Garen from comment #9) > > I don't think this patch can be right. It deletes an ASSERT and a comment > > explaining a problem, but it doesn't fix the problem. > > > > Consider ThunkGenerators.cpp::stringCharLoad and similar functions: > > > > // load index > > jit.loadInt32Argument(0, SpecializedThunkJIT::regT1); // regT1 contains > > the index > > > > // Do an unsigned compare to simultaneously filter negative indices as > > well as indices that are too large > > jit.appendFailure(jit.branch32(MacroAssembler::AboveOrEqual, > > SpecializedThunkJIT::regT1, SpecializedThunkJIT::regT2)); > > > > ... > > I think this is fine. That thunk calls the slow path (the C++ code) if it > fails that check. The C++ code does the right thing for positive offsets. It > will only fail if the unsigned offset they are looking for is > 2GB, which > is also exceedingly unlikely. It also doesn't seem like any of the other > code does the wrong thing. What's "any of the other code" in this context?
Note You need to log in before you can comment on or make changes to this bug.