Add to check the return of fseek() 36/198736/1 accepted/tizen/5.0/unified/20190220.071727 submit/tizen_5.0/20190219.010815
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 05:51:40 +0000 (05:51 +0000)
 - 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 6416cc31eb03fe403a551297f786c3827c12db73..b583ab85eee65e23416a562cf6763a7fd562d0d2 100755 (executable)
@@ -136,7 +136,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");