Closed BebeSparkelSparkel closed 6 months ago
Is it possible to add a regression test?
It may be possible, but I am unsure how to. This is a case of the last character in the buffer not being used because the bounds check was copy pasted from the above write* functions that have the possibility of writing two characters CRLF.
Would anything in the current test suite break if we put n - 10
instead of n
/ n + 1
? Do we have any tests in this area at all?
All tests pass with n - 10
I don't know how to test for buffer overflow unless we can add a test buffer type that checks for that.
We might not catch this in regular builds but we can test this by inserting a debug assertion (enabled by -DASSERTS
under the -fdeveloper
cabal flag) to ensure that writeCharBuf
is within bounds.
@Lysxia Good idea. I have added the bounds assertion to a wrapped writeCharBuf
@Bodigrim Anything else that needs to be done?
Thanks!
closes #587