[llvm-commits] [ASan] Define an internal implementation of strchr to make stack OOB tests pass (issue 5668047)

Timur Iskhodzhanov timurrrr at google.com
Tue Feb 14 10:26:09 PST 2012


On Tue, Feb 14, 2012 at 10:12 PM, Marshall Clow <mclow.lists at gmail.com> wrote:
> Isn't strchr defined to return a const char *?
Not in asan_interceptors.cc :369,  :380
:)

> And why all the mucking about with indexes?
>
> How about:
>
>        const char* internal_strchr(const char *s, int c) {
>          for ( ; *s; ++s )
>                if ( *s == c )
>                    return s;
>          return NULL;
>        }
> instead?
I think this is a wrong implementation as strchr(s="\0", 0) should
return s, not NULL.
I agree with "no need for indices" though, will update soon.




More information about the llvm-commits mailing list