Streamer bug with bufferSize #18

1 commit merged into from Nov 24, 2010

3 participants


Hi Chandru -

I ran into a bug where if I have X bytes already in the Streamer's buffer, and then I try to add Y bytes such that X + Y > bufferSize, I get an error - specifically:

end cannot be longer than parent.length
at Buffer.toString (buffer:36:19)
at Streamer.flush (/Users/dave/Documents/Misc/git/grasshopper/grasshopper/lib/ghp.js:175:36)
at Streamer.write (/Users/dave/Documents/Misc/git/grasshopper/grasshopper/lib/ghp.js:166:18)
at ../fixtures/ghp/too_big.txt:6:19
at Object.fill (/Users/dave/Documents/Misc/git/grasshopper/grasshopper/lib/ghp.js:36:120)
at Object.Too big template (/Users/dave/Documents/Misc/git/grasshopper/test/simple/ghp-test.js:78:13)
at /Users/dave/Documents/Misc/git/grasshopper/test/common/ghunit.js:46:35
at Object.setup (/Users/dave/Documents/Misc/git/grasshopper/test/common/ghunit.js:9:44)
at runTest (/Users/dave/Documents/Misc/git/grasshopper/test/common/ghunit.js:45:15)
at nextTest (/Users/dave/Documents/Misc/git/grasshopper/test/common/ghunit.js:30:13)

I've included a test case for this as well as the fix.



Damn, good catch. I've pulled in the fix at cskr/grasshopper@2e78c02.

Thanks a lot.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment