You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ospaths.isAbsolute: uncovering out of bound bugs after updating to 0.18.1 from 0.18.0: empty string and nil string now checked for out of bound errors
#8251
Closed
timotheecour opened this issue
Jul 8, 2018
· 3 comments
was trying to investigate haltcase/glob#15 (I can't reproduce this on Windows.)
Turns out it's because nim 0.18.0 and nim 0.18.1 handle empty and nil strings differently, and nim 0.18.1 correctly throws on out of bound errors.
The issue is that ospaths.isAbsolute doesn't check for out of bound errors in the code: result = path[0] == '/'
Should isAbsolute return false (as in dlang std.process.isAbsolute) on nil/empty string or throw? either way, should be documented. My feeling is that throwing sounds saner.
test.nim:
proc test2()=
try:
var a = ""
echo ("a[0]",a[0])
except Exception as e: echo e[]
try:
var a2: string = nil
echo ("a2[0]",a2[0])
except Exception as e: echo e[]
timotheecour
changed the title
ospaths.isAbsolute: uncovering out of bound bugs after updating to 0.18.1 from 0.18.0: empty string and nil string not now checked for out of bound errors
ospaths.isAbsolute: uncovering out of bound bugs after updating to 0.18.1 from 0.18.0: empty string and nil string now checked for out of bound errors
Jul 12, 2018
was trying to investigate haltcase/glob#15 (I can't reproduce this on Windows.)
Turns out it's because
nim 0.18.0
andnim 0.18.1
handle empty and nil strings differently, andnim 0.18.1
correctly throws on out of bound errors.The issue is that ospaths.isAbsolute doesn't check for out of bound errors in the code:
result = path[0] == '/'
isAbsolute
return false (as in dlang std.process.isAbsolute) on nil/empty string or throw? either way, should be documented. My feeling is that throwing sounds saner.test.nim:
nim 0.18.0:
nim 0.18.1:
=> good, 0.18.1 throws out of bound errors.
The text was updated successfully, but these errors were encountered: