Kaydet (Commit) 330aafb0 authored tarafından Guido van Rossum's avatar Guido van Rossum

For base 10, cast unsigned long to long before testing overflow.

This prevents 4294967296 from being an acceptable way to spell zero!
üst 30da0ea1
......@@ -128,8 +128,14 @@ int base;
temp = result;
result = result * base + c;
#ifndef MPW
if ((result - c) / base != temp) /* overflow */
ovf = 1;
if(base == 10) {
if(((long)(result - c) / base != temp)) /* overflow */
ovf = 1;
}
else {
if ((result - c) / base != temp) /* overflow */
ovf = 1;
}
#endif
str++;
}
......
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