Conversation
|
Are these user functions? Or just internal functions? |
|
Those are public libwabt C++ functions: all three are declared in the installed include/wabt/literal.h, so an embedding application can call them. They are not directly exposed through the WABT command-line tools, though. All current in-tree production call sites pass nonzero fixed-size buffers, and I found no .wat/.wasm input path that can make size zero. So the affected case is a library caller explicitly passing size == 0, rather than an input-triggerable issue in the bundled tools. |
|
If these function are not used we should just delete them instead of fixing them. |
|
Thanks. I rechecked the usage on current
My preference is therefore to keep the small zero-size guards. If you prefer removing the unused exposed function despite that compatibility risk, I can delete only |
|
The |
Fixes #2851.
The shared writer behind
WriteFloatHex()andWriteDoubleHex(), along withWriteUint128(), underflowssize - 1when called with a zero-sized output buffer. That produces an invalid copy length or array index.Return immediately for
size == 0in both implementations and add regressions covering all three public functions.Validation:
WERROR=ONCMake build andchecktarget: pass on macOS with AppleClang.