Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2019-12-25blob: fix OOB access in blob_check_typePetr Štetiar
Found by fuzzer: ERROR: AddressSanitizer: SEGV on unknown address 0x602100000455 The signal is caused by a READ memory access. #0 in blob_check_type blob.c:214:43 #1 in blob_parse_attr blob.c:234:9 #2 in blob_parse_untrusted blob.c:272:12 #3 in fuzz_blob_parse tests/fuzzer/test-blob-parse-fuzzer.c:34:2 #4 in LLVMFuzzerTestOneInput tests/fuzzer/test-blob-parse-fuzzer.c:39:2 Caused by following line: if (type == BLOB_ATTR_STRING && data[len - 1] != 0) where len was pointing outside of the data buffer. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25tests: use blob_parse_untrusted variantPetr Štetiar
In order to be able to use invalid input for testing as well. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25test: fuzz: add blob_parse crashesPetr Štetiar
==5872==ERROR: AddressSanitizer: SEGV on unknown address 0x6020004100b4 ==5872==The signal is caused by a READ memory access. #0 blob_data blob.h #1 blob_parse blob.c:228:2 Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25tests: add test cases for blob parsingPetr Štetiar
Increasing test coverage. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25tests: add libFuzzer based testsPetr Štetiar
LibFuzzer is in-process, coverage-guided, evolutionary fuzzing engine. LibFuzzer is linked with the library under test, and feeds fuzzed inputs to the library via a specific fuzzing entrypoint (aka "target function"); the fuzzer then tracks which areas of the code are reached, and generates mutations on the corpus of input data in order to maximize the code coverage. Lets use libFuzzer to fuzz blob and blobmsg parsing for the start. Ref: https://llvm.org/docs/LibFuzzer.html Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-12-25tests: add unit tests covered with Clang sanitizersPetr Štetiar
Currently we run all tests via Valgrind. This patch adds 2nd batch of tests which are compiled with Clang AddressSanitizer[1], LeakSanitizer[2] and UndefinedBehaviorSanitizer[3] in order to catch more issues during QA on CI. AddressSanitizer is a fast memory error detector. The tool can detect the following types of bugs: * Out-of-bounds accesses to heap, stack and globals * Use-after-free, use-after-return, use-after-scope * Double-free, invalid free LeakSanitizer is a run-time memory leak detector. It can be combined with AddressSanitizer to get both memory error and leak detection, or used in a stand-alone mode. UndefinedBehaviorSanitizer (UBSan) is a fast undefined behavior detector. UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution, for example: * Using misaligned or null pointer * Signed integer overflow * Conversion to, from, or between floating-point types which would overflow the destination 1. http://clang.llvm.org/docs/AddressSanitizer.html 2. http://http://clang.llvm.org/docs/LeakSanitizer.html 3. http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24tests: jshn: add more test casesPetr Štetiar
In order to cover all command line options. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24jshn: fix missing usage for -p and -o argumentsPetr Štetiar
Add missing usage hints for -p and -o arguments. Fixes: e16fa068a573 ("jshn: add support for namespaces") Fixes: eb30a03048f8 ("libubox, jshn: add option to write output to a file") Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24base64: fix possible null pointer dereferencePetr Štetiar
clang-10 analyzer reports following: base64.c:325:20: warning: Array access (from variable 'target') results in a null pointer dereference target[tarindex] = 0; ~~~~~~ ^ and prepared test case confirms it: Invalid write of size 1 at 0x4E4463F: b64_decode (base64.c:325) by 0x40088C: test_invalid_inputs (tests/test-base64.c:26) by 0x40088C: main (tests/test-base64.c:32) Address 0x1 is not stack'd, malloc'd or (recently) free'd Process terminating with default action of signal 11 (SIGSEGV) Access not within mapped region at address 0x1 at 0x4E4463F: b64_decode (base64.c:325) by 0x40088C: test_invalid_inputs (tests/test-base64.c:26) by 0x40088C: main (tests/test-base64.c:32) Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-24add cram based unit testsPetr Štetiar
For improved QA etc. For the start with initial test cases for avl, base64, jshn and list components. Moved runqueue and blobmsg from examples to tests. Converted just a few first test cases from json-script example into the new cram based unit test, more to come. Signed-off-by: Petr Štetiar <ynezz@true.cz>