UBSAN: runtime error: null pointer passed as argument 2, which is declared to never be null
Escargot (please complete the following information): Ubuntu 22.04.4 LTS Linux 5.15.0-125-generic #135-Ubuntu SMP Fri Sep 27 13:53:58 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux compiler: gcc (Debian 12.2.0-14) 12.2.0
Describe the bug I’ve scanned escargot with UBSAN and it has triggered on escargot/src/util/Vector.h line 33. I'm not sure whether this is an actual issue, or whether code of escargot is too sophisticated for UBSAN to understand. Do you guys have any idea?
Test case Test code to reproduce the behavior:
Launched escargot/build/escargot
Backtrace
escargot/build/escargot
escargot/src/util/Vector.h:33:15: runtime error: null pointer passed as argument 2, which is declared to never be null
Expected behavior No problem reported by UBSAN
Additional context escargot: master
IMO the tool is correct It is possible when other size is zero with Vector.h:195 IMO memcpy(?, NULL, 0) is undefined behavior. I will fix this issue
may fixed by #1439