Skip to content

strstr function does not perform well #67

Description

@HNYuuu

Describe the bug
In Wasm-samples/c_samples.nosync/source/test_c_library.c, we add a strstr function to illustrate the ability of our engine.

However, after several tests, we find that: once the needle is longer than 4 bytes, the strstr would invoke twoway_strstr, and the return value of strstr is always 0.

We find the source code of twoway_strstr, and put it in Wasm-samples/c_samples.nosync/source/twoway_strstr.c, whose result is equivalent to the real execution.

Thus, we guess the reason behind that is:

  • something error happened on the way from strstr to twoway_strstr
  • the twoway_strstr embedded in strstr is not equivalent to ours

To Reproduce
Directly execute these two samples to see the different:

The twoway_strstr we found:

python3 eunomia_entry -f /Users/ningyuhe/Downloads/test.wasm -s --onlyfunc __original_main --concrete_globals

The problematic strstr:

python3 eunomia_entry -f ./Wasm-samples/c_samples.nosync/wasi/test_c_library.wasm -s --onlyfunc __original_main --concrete_globals

Expected behavior
The haystack is TutorialPoint and the needle is Point. Thus, the output should be Point.

Activity

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

Metadata

Metadata

Assignees

Labels

HoldNot active issuebugSomething isn't workinghelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions