Parsing can become accidentally quadratic because of sscanf
Seen the GTA post already and the sscanf behavior is very surprising as one would expect it to parse the given string until the given format is satisfied or \0 is hit. Seems like this is not the case. Found this: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;23924112" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;23924112</a><p>&gt; sscanf() converts the string you pass in to an _IO_FILE* to make the string look like a &quot;file&quot;. This is so the same internal _IO_vfscanf() can be used for both a string and a FILE*. However, as part of that conversion, done in a _IO_str_init_static_internal() function, it calls __rawmemchr (ptr, &#x27;\0&#x27;); essentially a strlen() call, on your input string.<p>Looks correct. Call flow:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;21c3f4b5368686ade28d90d8c7d79c4c95c72c1b&#x2F;stdio-common&#x2F;sscanf.c#L34" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;21c3f4b5368686ade28d90d...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;21c3f4b5368686ade28d90d8c7d79c4c95c72c1b&#x2F;libio&#x2F;strfile.h#L90" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;21c3f4b5368686ade28d90d...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;21c3f4b5368686ade28d90d8c7d79c4c95c72c1b&#x2F;libio&#x2F;strops.c#L41" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;21c3f4b5368686ade28d90d...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;83908b3a1ea51e3aa7ff422275940e56dbba989f&#x2F;string&#x2F;rawmemchr.c#L39-L45" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bminor&#x2F;glibc&#x2F;blob&#x2F;83908b3a1ea51e3aa7ff422...</a>