UpdateAtlas currently uses *signed* integer type for its identifier. Due to the way we generate those IDs, it would be safer to use *unsigned* integers. This is because the generated ID will overflow at some point and the C and C++ language standards say that overflow of a signed value is undefined behaviour. In the C99 standard this is in section 6.5. In the C++98 standard it is in section 5 [expr], paragraph 5. "This means that a correct C/C++ program must never generate signed overflow when computing an expression. It also means that a compiler may assume that a program will never generated signed overflow". Note that gcc has -fwrapv flag to assume that signed arithmetic overflow of addition, subtraction and multiplication wraps around using twos-complement representation. However, I still believe it is safer and more consistent to use unsigned integers here.
Created attachment 178761 [details] Patch
Comment on attachment 178761 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=178761&action=review > Source/WebKit2/ChangeLog:14 > + This patch uses unsigned integer type for UpdateAtlas IDs. does unsigned have defined behavior?
(In reply to comment #2) > (From update of attachment 178761 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=178761&action=review > > > Source/WebKit2/ChangeLog:14 > > + This patch uses unsigned integer type for UpdateAtlas IDs. > > does unsigned have defined behavior? Yes, unsigned integer types are guaranteed to wrap on overflow in C / C++.
Created attachment 178775 [details] Patch for landing Updated the Changelog to clarify the behavior for unsigned integers on overflow.
Comment on attachment 178775 [details] Patch for landing Clearing flags on attachment: 178775 Committed r137293: <http://trac.webkit.org/changeset/137293>
All reviewed patches have been landed. Closing bug.