libubox/tests/cram/test_blob_buflen.t
Zefir Kurtisi a0dbcf8b8f tests: add blob-buffer overflow test
The blob buffer has no limitation in place
to prevent buflen to exceed maximum size.

This commit adds a test to demonstrate how
a blob increases past the maximum allowd
size of 16MB. It continuously adds chunks
of 64KB and with the 255th one blob_add()
returns a valid attribute pointer but the
blob's buflen does not increase.

The test is used to demonstrate the
failure, which is fixed with a follow-up
commit.

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@gmail.com>
[adjusted test case for cram usage]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2021-04-29 15:34:21 +02:00

9 lines
288 B
Perl

check that blob buffer cannot exceed maximum buffer length:
$ [ -n "$TEST_BIN_DIR" ] && export PATH="$TEST_BIN_DIR:$PATH"
$ valgrind --quiet --leak-check=full test-blob-buflen
SUCCESS: failed to allocate attribute
$ test-blob-buflen-san
SUCCESS: failed to allocate attribute