unicorn/qemu/include/qapi/qmp
liujunjie ea6ea4313d
qstring: Fix qstring_from_substr() not to provoke int overflow
qstring_from_substr() parameters @start and @end are of type int.
blkdebug_parse_filename(), blkverify_parse_filename(), nbd_parse_uri(),
and qstring_from_str() pass @end values of type size_t or ptrdiff_t.
Values exceeding INT_MAX get truncated, with possibly disastrous
results.

Such huge substrings seem unlikely, but we found one in a core dump,
where "info tlb" executed via QMP's human-monitor-command apparently
produced 35 GiB of output.

Fix by changing the parameters size_t.

Backports commit ad63c549ecd4af4a22a675a815edeb06b0e7bb6e from qemu
2018-08-02 21:21:51 -04:00
..
qbool.h qobject: use a QObjectBase_ struct 2018-05-04 10:11:24 -04:00
qdict.h qobject: use a QObjectBase_ struct 2018-05-04 10:11:24 -04:00
qerror.h qmp: Eliminate silly QERR_QMP_* macros 2018-03-02 11:28:17 -05:00
qjson.h import 2015-08-21 15:04:50 +08:00
qlist.h qobject: use a QObjectBase_ struct 2018-05-04 10:11:24 -04:00
qlit.h qlit: add qobject_from_qlit() 2018-03-20 10:30:41 -04:00
qnull.h qobject: Modify qobject_ref() to return obj 2018-05-04 10:24:10 -04:00
qnum.h qobject: use a QObjectBase_ struct 2018-05-04 10:11:24 -04:00
qobject.h qobject: Modify qobject_ref() to return obj 2018-05-04 10:24:10 -04:00
qstring.h qstring: Fix qstring_from_substr() not to provoke int overflow 2018-08-02 21:21:51 -04:00