folly json bug fix: overflow for -1LL<<63
Summary: -1LL<<63 was passed to folly::to() without '-' so it overflowed. Fixed that
Test Plan:
tried this:
int main() {
stringstream s;
s << "{\"int\":" << -1LL<<63 << "}";
string str = s.str();
cout << "string to parse: " << endl << str << endl;
int64_t sample = folly::parseJson(str.c_str())["int"].asInt();
LOG(INFO) << "test result = " << sample;
return 0;
}
it returns right value.
Also tried it with "-Infinity" and double type for sample. In works fine as well.
Reviewed By: andrei.alexandrescu@fb.com
FB internal diff:
D1130155