Skip to content

Instantly share code, notes, and snippets.

@samsonjs
Created August 27, 2010 11:17
Show Gist options
  • Save samsonjs/553200 to your computer and use it in GitHub Desktop.
Save samsonjs/553200 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
// Reduction of corrupted JSON bug, Object.freeze is broken
//
// Related? http://groups.google.com/a/chromium.org/group/chromium-bugs/browse_thread/thread/d9b1ff90110eda2d
console.log('Good JSON: ' + JSON.stringify({x: null}))
var i = 0
while (true) {
Object.freeze({})
if (++i % 1000 === 0) console.log(i)
if (JSON.stringify({x: null}).match(/\0/)) {
console.log('Bad JSON after ' + i + ' iterations: ' + JSON.stringify({x: null}))
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment