Added fix for handling TaintedStrings in streams and httpclient (#12969)

* Added fix for taint mode in streams and httpclient

* Removed taintMode export from system.nim
This commit is contained in:
Sam Wang 2019-12-29 08:37:22 -08:00 • committed by Andreas Rumpf
commit 441cacf70f
2 changed files with 14 additions and 6 deletions

View file

@ -96,6 +96,8 @@
include "system/inclrtl"
const taintMode = compileOption("taintmode")
proc newEIO(msg: string): owned(ref IOError) =
new(result)
result.msg = msg
@ -901,7 +903,10 @@ proc readLine*(s: Stream, line: var TaintedString): bool =
else:
# fallback
when nimvm: #Bug #12282
line.setLen(0)
when taintMode:
line.string.setLen(0)
else:
line.setLen(0)
else:
line.string.setLen(0)
while true:
@ -914,7 +919,10 @@ proc readLine*(s: Stream, line: var TaintedString): bool =
if line.len > 0: break
else: return false
when nimvm: #Bug #12282
line.add(c)
when taintMode:
line.string.add(c)
else:
line.add(c)
else:
line.string.add(c)
result = true