curl/src
Emanuele Torre 6c7da81561
tool_writeout_json: fix JSON encoding of non-ascii bytes
char variables if unspecified can be either signed or unsigned depending
on the platform according to the C standard; in most platforms, they are
signed.

This meant that the  *i<32  waas always true for bytes with the top bit
set. So they were always getting encoded as \uXXXX, and then since they
were also signed negative, they were getting extended with 1s causing
'\xe2' to be expanded to \uffffffe2, for example:

  $ curl --variable 'v=“' --expand-write-out '{{v:json}}\n' file:///dev/null
  \uffffffe2\uffffff80\uffffff9c

I fixed this bug by making the code use explicitly unsigned char*
variables instead of char* variables.

Test 268 verifies

Reported-by: iconoclasthero
Closes #12434
2023-12-01 10:39:13 +01:00
..
.checksrc tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
.gitignore
CMakeLists.txt base64: also build for curl 2023-10-04 23:22:16 +02:00
curl.rc curl.rc: switch out the copyright symbol for plain ASCII 2023-11-26 18:42:02 -05:00
Makefile.am autotools: accept linker flags via CURL_LDFLAGS_{LIB,BIN} 2023-11-14 13:39:34 +00:00
Makefile.inc curl: move IPFS code into src/tool_ipfs.[ch] 2023-11-07 07:42:28 +01:00
Makefile.mk
mkhelp.pl
slist_wc.c
slist_wc.h
tool_binmode.c
tool_binmode.h
tool_bname.c
tool_bname.h
tool_cb_dbg.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_cb_dbg.h
tool_cb_hdr.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_hdr.h
tool_cb_prg.c tool_cb_prg: make the carriage return fit for wide progress bars 2023-11-27 19:16:05 +01:00
tool_cb_prg.h
tool_cb_rea.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_rea.h
tool_cb_see.c build: delete support bits for obsolete Windows compilers 2023-11-06 22:00:10 +00:00
tool_cb_see.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_wrt.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_cb_wrt.h
tool_cfgable.c
tool_cfgable.h
tool_dirhie.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_dirhie.h
tool_doswin.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_doswin.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_easysrc.c
tool_easysrc.h
tool_filetime.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_filetime.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_findfile.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_findfile.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_formparse.c
tool_formparse.h
tool_getparam.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_getparam.h
tool_getpass.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_getpass.h
tool_help.c build: add more picky warnings and fix them 2023-11-21 16:35:42 +00:00
tool_help.h
tool_helpers.c
tool_helpers.h
tool_hugehelp.c.cvs
tool_hugehelp.h
tool_ipfs.c IPFS: bugfixes 2023-11-11 23:28:13 +01:00
tool_ipfs.h curl: move IPFS code into src/tool_ipfs.[ch] 2023-11-07 07:42:28 +01:00
tool_libinfo.c
tool_libinfo.h
tool_listhelp.c
tool_main.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_main.h tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_msgs.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_msgs.h
tool_operate.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_operate.h lib: fix comment typos 2023-11-23 12:35:59 +01:00
tool_operhlp.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_operhlp.h
tool_paramhlp.c
tool_paramhlp.h
tool_parsecfg.c test459: fix for parallel runs 2023-11-28 14:23:06 +01:00
tool_parsecfg.h
tool_progress.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_progress.h
tool_sdecls.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_setopt.c tool_setopt: remove unused function tool_setopt_flags 2023-09-26 17:55:11 -07:00
tool_setopt.h tool_setopt: remove unused function tool_setopt_flags 2023-09-26 17:55:11 -07:00
tool_setup.h windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_sleep.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_sleep.h
tool_stderr.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_stderr.h
tool_strdup.c
tool_strdup.h
tool_urlglob.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_urlglob.h
tool_util.c windows: use built-in _WIN32 macro to detect Windows 2023-11-22 15:42:25 +00:00
tool_util.h
tool_version.h
tool_vms.c
tool_vms.h
tool_writeout_json.c tool_writeout_json: fix JSON encoding of non-ascii bytes 2023-12-01 10:39:13 +01:00
tool_writeout_json.h
tool_writeout.c tool: use our own stderr variable 2023-09-28 10:50:56 +00:00
tool_writeout.h
tool_xattr.c build: add more picky warnings and fix them 2023-11-21 16:35:42 +00:00
tool_xattr.h
var.c misc: fix -Walloc-size warnings 2023-11-11 23:35:47 +01:00
var.h