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.
Describe the bug
In
Wasm-samples/c_samples.nosync/source/test_c_library.c, we add astrstrfunction to illustrate the ability of our engine.However, after several tests, we find that: once the
needleis longer than 4 bytes, thestrstrwould invoketwoway_strstr, and the return value ofstrstris always0.We find the source code of
twoway_strstr, and put it inWasm-samples/c_samples.nosync/source/twoway_strstr.c, whose result is equivalent to the real execution.Thus, we guess the reason behind that is:
strstrtotwoway_strstrtwoway_strstrembedded instrstris not equivalent to oursTo Reproduce
Directly execute these two samples to see the different:
The
twoway_strstrwe found:The problematic
strstr:Expected behavior
The haystack is
TutorialPointand the needle isPoint. Thus, the output should bePoint.