checkpolicy/fuzz: fix setjmp condition

setjmp(3) returns 0 on the first fake invocation, adjust the condition
accordingly.

Reported by the OSS Fuzz Introspector[1].

[1]: https://storage.googleapis.com/oss-fuzz-introspector/selinux/inspector-report/20241016/fuzz_report.html

Fixes: f07fc2a75 ("checkpolicy/fuzz: override YY_FATAL_ERROR")
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Christian Göttsche 2024-10-18 17:12:13 +02:00 committed by James Carter
parent cecbff935b
commit e7bbd67be6
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@ static int read_source_policy(policydb_t *p, const uint8_t *data, size_t size)
init_parser(1); init_parser(1);
if (!setjmp(fuzzing_pre_parse_stack_state)) { if (setjmp(fuzzing_pre_parse_stack_state) != 0) {
queue_destroy(id_queue); queue_destroy(id_queue);
fclose(yyin); fclose(yyin);
yylex_destroy(); yylex_destroy();