mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #44 from sharelatex/bg-add-null-byte-checks
add null byte checks
This commit is contained in:
commit
7497c066ee
1 changed files with 10 additions and 0 deletions
|
@ -162,6 +162,12 @@ module.exports = RedisManager =
|
||||||
return callback(error)
|
return callback(error)
|
||||||
|
|
||||||
jsonOps = appliedOps.map (op) -> JSON.stringify op
|
jsonOps = appliedOps.map (op) -> JSON.stringify op
|
||||||
|
for op in jsonOps
|
||||||
|
if op.indexOf("\u0000") != -1
|
||||||
|
error = new Error("null bytes found in jsonOps")
|
||||||
|
logger.error err: error, doc_id: doc_id, jsonOps: jsonOps, error.message
|
||||||
|
return callback(error)
|
||||||
|
|
||||||
newDocLines = JSON.stringify(docLines)
|
newDocLines = JSON.stringify(docLines)
|
||||||
if newDocLines.indexOf("\u0000") != -1
|
if newDocLines.indexOf("\u0000") != -1
|
||||||
error = new Error("null bytes found in doc lines")
|
error = new Error("null bytes found in doc lines")
|
||||||
|
@ -176,6 +182,10 @@ module.exports = RedisManager =
|
||||||
if error?
|
if error?
|
||||||
logger.error {err: error, doc_id}, error.message
|
logger.error {err: error, doc_id}, error.message
|
||||||
return callback(error)
|
return callback(error)
|
||||||
|
if ranges? and ranges.indexOf("\u0000") != -1
|
||||||
|
error = new Error("null bytes found in ranges")
|
||||||
|
logger.error err: error, doc_id: doc_id, ranges: ranges, error.message
|
||||||
|
return callback(error)
|
||||||
multi = rclient.multi()
|
multi = rclient.multi()
|
||||||
multi.eval setScript, 1, keys.docLines(doc_id:doc_id), newDocLines # index 0
|
multi.eval setScript, 1, keys.docLines(doc_id:doc_id), newDocLines # index 0
|
||||||
multi.set keys.docVersion(doc_id:doc_id), newVersion # index 1
|
multi.set keys.docVersion(doc_id:doc_id), newVersion # index 1
|
||||||
|
|
Loading…
Reference in a new issue