On 3/31/26 23:54, Pádraig Brady wrote:
Just had a quick look at argv-iter, and I think we'd have to extend
the init interface to support a max_item_len parameter,
as it's currently not specific to files.

I suppose you could have a argv_iter_init_files0_stream() that
calls argv_iter_init_stream() but also sets a limit to PATH_MAX.

However I now also see that we still need to discard bytes.

yes, that could be a good way, thanks.

I.e. with getndelim2() we'd be changing an OOM to an infinite loop.

That's right, although systems can cope much better with infinite loops
than with OOM.

So doing this would only help the case where we have huge items
that eventually terminate.  I can't think of a practical case
where that might happen though.

I only accidentally fell over this case late at night when I wanted to see how
'find -files0-from=...' behaves when a certain file name was given a huge number
of times, and then tried to feed it with the not-working `yes $'/dev/null\0'`
(where the terminating '\0' never makes it through the pipe).

Therefore, I don't see a practical use-case, but it would be hard to explain why
we don't guard the system from OOM now as we know the case already.

Have a nice day,
Berny

Reply via email to