Bug 49634 - Make overflow guards in WTF::String::utf8 explicit
Summary: Make overflow guards in WTF::String::utf8 explicit
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2010-11-16 17:27 PST by David Kilzer (:ddkilzer)
Modified: 2010-11-17 08:51 PST (History)
2 users (show)

See Also:


Attachments
Patch (2.11 KB, patch)
2010-11-16 17:30 PST, David Kilzer (:ddkilzer)
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2010-11-16 17:27:45 PST
Make overflow guards in WTF::String::utf8 explicit
Comment 1 David Kilzer (:ddkilzer) 2010-11-16 17:30:49 PST
Created attachment 74071 [details]
Patch
Comment 2 David Kilzer (:ddkilzer) 2010-11-16 17:31:29 PST
<rdar://problem/8675768>
Comment 3 Darin Adler 2010-11-16 18:01:28 PST
Comment on attachment 74071 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=74071&action=review

> JavaScriptCore/wtf/text/WTFString.cpp:700
> +    if (length > numeric_limits<unsigned>::max() / 3)

If we changed the type of the local variable length to size_t instead of unsigned, then this could just check against size_t instead of unsigned, giving us a higher limit on 64-bit platforms.
Comment 4 David Kilzer (:ddkilzer) 2010-11-16 18:08:04 PST
(In reply to comment #3)
> (From update of attachment 74071 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=74071&action=review
> 
> > JavaScriptCore/wtf/text/WTFString.cpp:700
> > +    if (length > numeric_limits<unsigned>::max() / 3)
> 
> If we changed the type of the local variable length to size_t instead of unsigned, then this could just check against size_t instead of unsigned, giving us a higher limit on 64-bit platforms.

Thanks.  I filed Bug 49637.
Comment 5 David Kilzer (:ddkilzer) 2010-11-17 08:39:20 PST
Committed r72209: <http://trac.webkit.org/changeset/72209>