Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: src/IceGlobalContext.cpp

Issue 300563003: Subzero: Initial O2 lowering (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 7a21b401f36f2c5098bddecd0aa102504842a248..e4b2d892b76df07d687fb610f362e0c4797c0468 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -129,7 +129,9 @@ IceString GlobalContext::mangleName(const IceString &Name) const {
return NewName;
}
- ItemsParsed = sscanf(Name.c_str(), "_Z%u%s", &BaseLength, NameBase);
+ // Artificially limit BaseLength to 9 digits (less than 1 billion)
+ // because sscanf behavior is undefined on integer overflow.
JF 2014/05/25 22:50:50 Add an assert that has this comment.
Jim Stichnoth 2014/05/29 01:39:46 An assert isn't appropriate here. The idea is to
+ ItemsParsed = sscanf(Name.c_str(), "_Z%9u%s", &BaseLength, NameBase);
if (ItemsParsed == 2 && BaseLength <= strlen(NameBase)) {
// Transform _Z3barxyz ==> _ZN6Prefix3barExyz
// ^^^^^^^^ ^

Powered by Google App Engine
This is Rietveld 408576698