Add to check the return of fseek() 85/198685/1 accepted/tizen/unified/20190207.120256 submit/tizen/20190131.041045
authorjiyong.min <jiyong.min@samsung.com>
Tue, 29 Jan 2019 00:23:09 +0000 (09:23 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 29 Jan 2019 00:23:09 +0000 (09:23 +0900)
 - If fseek() is failed, -1 is returned and errno is set to indicate the errors.

Change-Id: Idf08b42325a5ebb9ede3702fc057d8058578669b

decode-test/image_util_decode_encode_testsuite.c

index 5a7ae55..03b3e83 100755 (executable)
@@ -133,7 +133,13 @@ static gboolean _read_file(const char *file_name, void **data, size_t *data_size
                return FALSE;
        }
 
-       fseek(fp, 0, SEEK_END);
+       if (fseek(fp, 0, SEEK_END) < 0) {
+               fprintf(stderr, "\t[JPEG_testsuite] fseek failed \n");
+               fclose(fp);
+               fp = NULL;
+               return FALSE;
+       }
+
        file_size = ftell(fp);
        if (file_size < 0) {
                fprintf(stderr, "\t[JPEG_testsuite] ftell failed \n");