coolxv / cpp-stub

C++ unit test stub(not mock) and awesome.Surpported ISA x86,x86-64,arm64,arm32,arm thumb,mips64,riscv,loongarch64.
MIT License
280 stars 82 forks source link

fix use set more than once,will crash #13

Closed uniontech-lisa closed 3 years ago

uniontech-lisa commented 3 years ago

Fix that when using the same instance of stub, piling the same function twice, calling set (inconsistent piling functions twice), decomposing the instance of stub, or calling reset with the same instance of stub, restoring the previous function address is the function address of the first piling, not the original function address, which may cause crash and inconsistent with the expected result. Only the original address is saved every time.

coolxv commented 3 years ago

Thanks, bug fixed. Modify to call reset() on each set(). #14