Skip to content

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

@Hacker-vision

Description

@Hacker-vision

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions