Skip to content

Non UTF-8 byte sequences in response body causes crashes

If the server responds with a non-UTF-8 byte sequence that causes a crash.

Environment

YDB Web server version: Current master

$ ydb -run %XCMD 'w $zyre,!,$zch,!'
YottaDB r2.00 Linux x86_64
UTF-8

How to reproduce

Add to _ydbwebapi.m:

getbinary
	set httprsp("mime")="application/octet-stream"
	set httprsp=$zchar(128)
	quit

Add to _ydbweburl.m:

	;;GET test/getbinary getbinary^%ydbwebapi

Start:

$ ydb -run start^%ydbwebreq
Starting Server at port 9080 in directory /my/working/dir at logging level 0

Call:

$ curl http://localhost:9080/test/getbinary
curl: (52) Empty reply from server

Log:

::ffff:127.0.0.1 - - [03/JAN/2025 02:28:11 PM] Response:
httprsp=$ZCH(128)
httprsp("mime")="application/octet-stream"
::ffff:127.0.0.1 - - [03/JAN/2025 02:28:11 PM] Error: 150381066,sendata+29^%ydbwebrsp,%YDB-E-BADCHAR, $ZCHAR(128) is not a valid character in the UTF-8 encodi
ng form