Distributive-Network / PythonMonkey

A Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment.
https://pythonmonkey.io
Other
854 stars 40 forks source link

New Build warnings following latest changes #426

Closed philippedistributive closed 2 months ago

philippedistributive commented 2 months ago

Issue type

Bug

How did you install PythonMonkey?

None

OS platform and distribution

No response

Python version (python --version)

No response

PythonMonkey version (pip show pythonmonkey)

No response

Bug Description

Regression introduced by https://github.com/Distributive-Network/PythonMonkey/pull/417: build warnings

/home/philippe/Sources/PythonMonkey/src/PyBytesProxyHandler.cc: In function ‘bool array_valueOf(JSContext, unsigned int, JS::Value)’: /home/philippe/Sources/PythonMonkey/src/PyBytesProxyHandler.cc:46:44: warning: ‘%d’ directive output truncated writing between 1 and 3 bytes into a region of size 0 [-Wformat-truncation=] 46 | snprintf((char )&buffer[charIndex], 4, "%d", data[0]); | ^~ /home/philippe/Sources/PythonMonkey/src/PyBytesProxyHandler.cc:46:43: note: directive argument in the range [0, 255] 46 | snprintf((char )&buffer[charIndex], 4, "%d", data[0]); | ^~~~ In file included from /usr/include/stdio.h:980, from /home/philippe/Sources/PythonMonkey/_spidermonkey_install/include/mozjs-130a1/mozilla/Assertions.h:68, from /home/philippe/Sources/PythonMonkey/_spidermonkey_install/include/mozjs-130a1/mozilla/AlreadyAddRefed.h:14, from /home/philippe/Sources/PythonMonkey/_spidermonkey_install/include/mozjs-130a1/jsapi.h:12, from /home/philippe/Sources/PythonMonkey/include/PyBaseProxyHandler.hh:14, from /home/philippe/Sources/PythonMonkey/include/PyObjectProxyHandler.hh:14, from /home/philippe/Sources/PythonMonkey/include/PyBytesProxyHandler.hh:15, from /home/philippe/Sources/PythonMonkey/src/PyBytesProxyHandler.cc:12: In function ‘int snprintf(char, size_t, const char, ...)’, inlined from ‘bool array_valueOf(JSContext, unsigned int, JS::Value)’ at /home/philippe/Sources/PythonMonkey/src/PyBytesProxyHandler.cc:46:11: /usr/include/x86_64-linux-gnu/bits/stdio2.h:54:35: note: ‘builtin___snprintf_chk’ output between 2 and 4 bytes into a destination of size 0 54 | return builtin_snprintf_chk (s, n, USE_FORTIFY_LEVEL - 1, | ~~~~~^~~~~~~~~~~ 55 | __glibc_objsize (s), fmt, | ~~~~~~~~~ 56 | __va_arg_pack ()); | ~~~~~

Standalone code to reproduce the issue

No response

Relevant log output or backtrace

No response

Additional info if applicable

No response

What branch of PythonMonkey were you developing on? (If applicable)

No response