PP: Address #1456: Strip float suffixes before using platform library.
authorJohn Kessenich <cepheus@frii.com>
Fri, 27 Jul 2018 19:08:05 +0000 (13:08 -0600)
committerJohn Kessenich <cepheus@frii.com>
Fri, 27 Jul 2018 19:08:05 +0000 (13:08 -0600)
glslang/MachineIndependent/preprocessor/PpScanner.cpp

index 025e39a..1faa018 100755 (executable)
@@ -317,8 +317,19 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
     } else {
         // slow path
         ppToken->dval = 0.0;
+
+        // remove suffix
+        TString numstr(ppToken->name);
+        if (numstr.back() == 'f' || numstr.back() == 'F')
+            numstr.pop_back();
+        if (numstr.back() == 'h' || numstr.back() == 'H')
+            numstr.pop_back();
+        if (numstr.back() == 'l' || numstr.back() == 'L')
+            numstr.pop_back();
+
+        // use platform library
         strtodStream.clear();
-        strtodStream.str(ppToken->name);
+        strtodStream.str(numstr.c_str());
         strtodStream >> ppToken->dval;
         if (strtodStream.fail()) {
             // Assume failure combined with a large exponent was overflow, in