qemu-e2k/qom
Ani Sinha 1bf8b88f14 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>
2020-12-10 17:32:26 -05:00
..
container.c qom/container: remove .instance_size initializer from container_info 2020-06-10 12:09:59 -04:00
meson.build qom: Move the creation of the library to the main meson.build 2020-10-12 11:50:20 -04:00
object_interfaces.c qom: Add user_creatable_print_help_from_qdict() 2020-10-15 16:06:27 +02:00
object.c qom: code hardening - have bound checking while looping with integer value 2020-12-10 17:32:26 -05:00
qom-hmp-cmds.c qom: Make info qom-tree sort children more efficiently 2020-07-21 17:39:37 +02:00
qom-qmp-cmds.c qom: Improve {qom,device}-list-properties error messages 2020-12-10 17:16:44 +01:00
qom-qobject.c error: Eliminate error_propagate() manually 2020-07-10 15:18:08 +02:00
trace-events
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00