View Single Post
Old 06-24-2019, 01:36 PM   #142
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,506
Karma: 26047202
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@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.

Last edited by NiLuJe; 06-24-2019 at 01:39 PM.
NiLuJe is offline   Reply With Quote