diff options
author | Ani Sinha | 2020-09-21 11:33:25 +0200 |
---|---|---|
committer | Eduardo Habkost | 2020-12-10 23:32:26 +0100 |
commit | 1bf8b88f144bee747e386c88d45d772e066bbb36 (patch) | |
tree | 060d35f9e5e4eca60072e0a5c2931c43fd648b8e /include/sysemu | |
parent | Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2020-12-10' into ... (diff) | |
download | qemu-1bf8b88f144bee747e386c88d45d772e066bbb36.tar.gz qemu-1bf8b88f144bee747e386c88d45d772e066bbb36.tar.xz qemu-1bf8b88f144bee747e386c88d45d772e066bbb36.zip |
qom: code hardening - have bound checking while looping with integer value
Object property insertion code iterates over an integer to get an unused
index that can be used as an unique name for an object property. This loop
increments the integer value indefinitely. Although very unlikely, this can
still cause an integer overflow.
In this change, we fix the above code by checking against INT16_MAX and making
sure that the interger index does not overflow beyond that value. If no
available index is found, the code would cause an assertion failure. This
assertion failure is necessary because the callers of the function do not check
the return value for NULL.
Signed-off-by: Ani Sinha <ani@anisinha.ca>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200921093325.25617-1-ani@anisinha.ca>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/sysemu')
0 files changed, 0 insertions, 0 deletions