diff options
author | Pierre Joye <pierre.php@gmail.com> | 2022-02-01 22:53:37 +0700 |
---|---|---|
committer | Pierre Joye <pierre.php@gmail.com> | 2022-02-01 22:53:37 +0700 |
commit | 7875a3337783227aca58f63d2589635821ca15bc (patch) | |
tree | 687df0719ca36e0eca4a9c2aa9187133ca23a78b | |
parent | 11f05e5b6152190b778089286def44406db4daf7 (diff) | |
download | libgd-bug/818.tar.gz |
partial #818, fix again that logic. I need to find something more generic and convenient to handle errors, assert and free used resources on fail assertbug/818
-rw-r--r-- | tests/tiff/tiff_invalid_read.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/tiff/tiff_invalid_read.c b/tests/tiff/tiff_invalid_read.c index c79ea90..3fd2a63 100644 --- a/tests/tiff/tiff_invalid_read.c +++ b/tests/tiff/tiff_invalid_read.c @@ -53,7 +53,7 @@ static size_t read_test_file(char **buffer, char *basename) } exp_size = ftell(fp); - if (!gdTestAssert(exp_size > 0)) { + if (exp_size <= 0) { gdTestAssert(1==0); // only increase num failures used as return values in main goto fail2; } @@ -64,9 +64,11 @@ static size_t read_test_file(char **buffer, char *basename) } *buffer = malloc(exp_size); - if (gdTestAssert(*buffer != NULL)) { + if (*buffer != NULL) { act_size = fread(*buffer, sizeof(**buffer), exp_size, fp); gdTestAssert(act_size == exp_size); + } else { + gdTestAssert(0); } fail2: |