Fix the undefined behaviour when negating the minimum value integers in Reader
This commit is contained in:
parent
f688b2b152
commit
1a570c342d
@ -967,13 +967,13 @@ private:
|
|||||||
else {
|
else {
|
||||||
if (use64bit) {
|
if (use64bit) {
|
||||||
if (minus)
|
if (minus)
|
||||||
cont = handler.Int64(-(int64_t)i64);
|
cont = handler.Int64(static_cast<int64_t>(~i64 + 1));
|
||||||
else
|
else
|
||||||
cont = handler.Uint64(i64);
|
cont = handler.Uint64(i64);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (minus)
|
if (minus)
|
||||||
cont = handler.Int(-(int)i);
|
cont = handler.Int(static_cast<int32_t>(~i + 1));
|
||||||
else
|
else
|
||||||
cont = handler.Uint(i);
|
cont = handler.Uint(i);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user