make check-unit: use after free in test-opts-visitor
authorAndrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Mon, 5 Aug 2019 17:03:06 +0000 (20:03 +0300)
committerMarkus Armbruster <armbru@redhat.com>
Tue, 24 Sep 2019 09:03:44 +0000 (11:03 +0200)
commit863f195fa823c0c20d734dadfc5908c2aea34330
tree78c27869d1e0d19c7a7ec9cdf5079848855873f9
parent81b49004e0846b3526e26c786b6f64d4f1a0e38a
make check-unit: use after free in test-opts-visitor

In the struct OptsVisitor, the 'repeated_opts' member points to a list
in the 'unprocessed_opts' hash table after the list has been destroyed.
A subsequent call to visit_type_int() references the deleted list.
It results in use-after-free issue reproduced by running the test case
under the Valgrind: valgrind tests/test-opts-visitor.
A new mode ListMode::LM_TRAVERSED is declared to mark the list
traversal completed.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Message-Id: <1565024586-387112-1-git-send-email-andrey.shinkevich@virtuozzo.com>
qapi/opts-visitor.c