Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup a strtok_s function's bug while testing on SPEC2006 #24

Open
Hacker-vision opened this issue Dec 28, 2018 · 0 comments
Open

fixup a strtok_s function's bug while testing on SPEC2006 #24

Hacker-vision opened this issue Dec 28, 2018 · 0 comments
Labels

Comments

@Hacker-vision
Copy link

Line 322 need to add one line " *ptr = dest; " to keep *ptr with the same value of *saveptr in glibc __strtok_r.

I found strtok_s() leads to an endless loop while running hmmio.c (Line 1411-1415) in hmmer of SPEC 2006. Using gdb to check it I found the *ptr remains the same value while glibc not.

The trick is that when we cannot find delimiter in src we have to point the *ptr to the end of dest,while in strtok_s *ptr points to the start.

hmmio.c source code:
while (sptr != NULL) { fprintf(fp, "%s%s\n", pfx, sptr); sptr = strtok(NULL, "\n"); }

__strtok_r in glibc : https://github.com/lattera/glibc/blob/master/string/strtok_r.c

@dmwheel1 dmwheel1 added the bug label Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants