stb: added exceptional handling. accepted/tizen/unified/20190905.232211 submit/tizen/20190905.064609
authorHermet Park <hermetpark@gmail.com>
Wed, 4 Sep 2019 08:26:26 +0000 (17:26 +0900)
committerHermet Park <hermetpark@gmail.com>
Wed, 4 Sep 2019 08:29:08 +0000 (17:29 +0900)
ftell() could return -1  but fseek() doesn't allow minus values.

Modified to skip irritating coverity report.

Change-Id: I7f66c2d0a3514d324ad23159c20be9fe1bb17724

src/vector/stb/stb_image.h

index 61d9224..acfdfc0 100644 (file)
@@ -7187,7 +7187,7 @@ STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp)
    long pos = ftell(f);
    stbi__start_file(&s, f);
    r = stbi__info_main(&s,x,y,comp);
-   fseek(f,pos,SEEK_SET);
+   if (pos >= 0) fseek(f,pos,SEEK_SET);
    return r;
 }