stb: added exceptional handling.
authorHermet Park <hermetpark@gmail.com>
Wed, 4 Sep 2019 08:23:10 +0000 (17:23 +0900)
committerHermet Park <hermetpark@gmail.com>
Wed, 4 Sep 2019 08:29:01 +0000 (17:29 +0900)
ftell() could return -1  but fseek() doesn't allow minus values.

Modified to skip irritating coverity report.

Change-Id: Id2dbe0bb0852b3b30f5afe86b1677c99d5229e03

src/vector/stb/stb_image.h

index 8c85e52..61d9224 100644 (file)
@@ -7208,7 +7208,7 @@ STBIDEF int stbi_is_16_bit_from_file(FILE *f)
    long pos = ftell(f);
    stbi__start_file(&s, f);
    r = stbi__is_16_main(&s);
-   fseek(f,pos,SEEK_SET);
+   if (pos >= 0) fseek(f,pos,SEEK_SET);
    return r;
 }
 #endif // !STBI_NO_STDIO