Open phillipjohnston opened 4 years ago
The reason for this ASan complaint is strlen
reads its data in units of unsigned long
, which means it can read more bytes than are in the object containing the string, which has undefined behavior per C11 6.5.6/8. I ran into this with my pointer verifier tool.
The Stack Overflow question Why does glibc's strlen need to be so complicated to run quickly? discusses a similar situation in glibc. My short summary of that discussion is "it's ok because glibc is meant to be used with GCC".
However, my understanding is the EA libc is meant to work with any standard-compliant C compiler, so at least in theory, this strlen
could be problematic. But, as with issue #181, I'm just noting it and moving on.
But, I might suggest adding "strlen" to the issue title to distinguish it from other potential ASan findings.