mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
OptsVisitor: don't try to flatten overlong integer ranges
Prevent mistyped command line options from incurring high memory and CPU usage at startup. 64K elements in a range should be enough for everyone (TM). The OPTS_VISITOR_RANGE_MAX macro is public so that unit tests can construct corner cases with it. Signed-off-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
committed by
Luiz Capitulino
parent
581a8a8000
commit
15a849be10
@@ -16,6 +16,12 @@
|
||||
#include "qapi/visitor.h"
|
||||
#include "qemu/option.h"
|
||||
|
||||
/* Inclusive upper bound on the size of any flattened range. This is a safety
|
||||
* (= anti-annoyance) measure; wrong ranges should not cause long startup
|
||||
* delays nor exhaust virtual memory.
|
||||
*/
|
||||
#define OPTS_VISITOR_RANGE_MAX 65536
|
||||
|
||||
typedef struct OptsVisitor OptsVisitor;
|
||||
|
||||
/* Contrarily to qemu-option.c::parse_option_number(), OptsVisitor's "int"
|
||||
|
||||
Reference in New Issue
Block a user