Quote:
Originally Posted by NiLuJe
@frostschutz: Pushed the linefeeds fixes  .
@sherman: They're here. I *think* that's a somewhat sensible approach, but you're probably more familiar with this logic than I am. It's mostly all related to not calling u8_dec when the index is 0, as it would happily look *before* the buffer, and underflow the index.
Besides the test-cases provided by @frostschutz, the only other edge-case I could actually trigger is with a single character *right* above the size limit. I couldn't actually trigger a crash, but I did get an underflow, and by chance it happened to find a bogus break (very) soon after the wrapped-around value, so it mostly slipped through the cracks unnoticed.
Now it reliably aborts with the proper "you blew the LW" error.
|
Looks like it should be ok. Bit of an oopsie there wasn't it. I might have been inclined to just strip leading/trailing linebreaks, but your solution is probably more correct.
I'm writing this while awaiting a flight at San Diego airport, so take my "review" with a dash of salt...