On Wed, 12 Aug 2026, Alexander Monakov wrote:

> > +  const uchar *limit = (const uchar*) ((uintptr_t)end & ~15);
> 
> This is not safe in absence of padding: when 's' itself is not aligned,
> and 'end' is close to it, this may move 'limit' to before 's', and then
> the load from *limit will pick up bytes prior to 's'.
> 
> Now, libcpp provides sufficient tail padding (at least 16 bytes, with '\n'
> at the beginning of padding area) so in context this is safe, but then
> the final aligned load should never be reached, and computing 'limit' is
> pointless.

Correction: search_line_fast is called with 'end' pointing to the beginning
of the padding area, not the end, so this is just unsafe (aligning 'end'
can move it to before 's').

Alexander

Reply via email to