escargot icon indicating copy to clipboard operation
escargot copied to clipboard

UBSAN: runtime error: null pointer passed as argument 2, which is declared to never be null

Open JohnSmithBH84 opened this issue 6 months ago • 2 comments

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

JohnSmithBH84 avatar Jun 06 '25 13:06 JohnSmithBH84

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

ksh8281 avatar Jun 10 '25 05:06 ksh8281

may fixed by #1439

ksh8281 avatar Jun 11 '25 08:06 ksh8281