From: Miguel de Icaza Date: Sat, 6 Apr 2019 09:35:07 +0000 (-0400) Subject: [metadata] Handle condition in ftell, Coverity 1307192 (mono/mono#13862) X-Git-Tag: submit/tizen/20210909.063632~10331^2~5^2~1471 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25770847280cc44c4bd579ca55c9ea2c6dcb8248;p=platform%2Fupstream%2Fdotnet%2Fruntime.git [metadata] Handle condition in ftell, Coverity 1307192 (mono/mono#13862) ftell can be a negative value, handle that scenario. Commit migrated from https://github.com/mono/mono/commit/af4b09ba27f4238c49696b529984167e9baa1a3d --- diff --git a/src/mono/mono/metadata/seq-points-data.c b/src/mono/mono/metadata/seq-points-data.c index 7adbfe9..d911258 100644 --- a/src/mono/mono/metadata/seq-points-data.c +++ b/src/mono/mono/metadata/seq-points-data.c @@ -401,6 +401,11 @@ mono_seq_point_data_read (SeqPointData *data, char *path) fseek(f, 0, SEEK_END); fsize = ftell(f); + if (fsize == -1){ + fclose (f); + return FALSE; + } + fseek(f, 0, SEEK_SET); buffer_orig = buffer = (guint8 *)g_malloc (fsize + 1);