Commit cfe7b2c4 by Jamie Madill Committed by Commit Bot

Add finite check to lexer float constants.

The fuzzer was generating cases where floating point constants would someone return as valid when they were beyond max float. I was unable to reproduce this in a standalone test, but confirmed this check fixes the fuzzer error. BUG=660702 Change-Id: I9e6b883958013638ea509e38b30e812a9e74fbc1 Reviewed-on: https://chromium-review.googlesource.com/406268Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent d75d03bd
......@@ -9,6 +9,7 @@
#ifndef COMPILER_PREPROCESSOR_NUMERICLEX_H_
#define COMPILER_PREPROCESSOR_NUMERICLEX_H_
#include <cmath>
#include <sstream>
namespace pp {
......@@ -63,7 +64,7 @@ bool numeric_lex_float(const std::string &str, FloatType *value)
stream.imbue(std::locale::classic());
stream >> (*value);
return !stream.fail();
return !stream.fail() && std::isfinite(*value);
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment