git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t4062: stop using repetition in regex

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2017, 05:29 UTC
Message-ID
<xmqqtw1h8g1u.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<cd60d779-fe38-4f0e-4d36-2c40b2afec7d@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 12 quoted lines
> Am 09.08.2017 um 00:26 schrieb Junio C Hamano:
>> ... but in the meantime, I think replacing the test with "0$" to
>> force the scanner to find either the end of line or the end of the
>> buffer may be a good workaround.  We do not have to care how many of
>> random bytes are in front of the last "0" in order to ensure that
>> the regexec_buf() does not overstep to 4097th byte, while seeing
>> that regexec() that does not know how long the haystack is has to do
>> so, no?
>
> Our regexec() calls strlen() (see my other reply).
>
> Using "0$" looks like the best option to me.

Yeah, it seems that way. If we want to be close/faithful to the original, we could do "^0*$", but the part that is essential to trigger the old bug is not the "we have many zeroes" (or "we have 4096 zeroes") part, but "zero is at the end of the string" part, so "0$" would be the minimal pattern that also would work for OBSD.

Dscho?
Previous: René ScharfeNext: René Scharfe
Message 7 of 17 in “t4062: stop using repetition in regex”
  1. t4062: stop using repetition in regexRené Scharfe, Aug 8, 2017
  2. Johannes SchindelinAug 8, 2017
  3. René ScharfeAug 8, 2017
  4. Junio C HamanoAug 8, 2017
  5. Junio C HamanoAug 8, 2017
  6. René ScharfeAug 8, 2017
  7. Junio C HamanoAug 9, 2017
  8. René ScharfeAug 9, 2017
  9. René ScharfeAug 9, 2017
  10. David CoppaAug 9, 2017
  11. Johannes SchindelinAug 9, 2017
  12. Junio C HamanoAug 9, 2017
  13. René ScharfeAug 9, 2017
  14. Junio C HamanoAug 9, 2017
  15. René ScharfeAug 10, 2017
  16. Junio C HamanoAug 11, 2017
  17. René ScharfeAug 8, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.