Skip to content
This repository was archived by the owner on Jul 20, 2026. It is now read-only.
This repository was archived by the owner on Jul 20, 2026. It is now read-only.

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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