From 25770847280cc44c4bd579ca55c9ea2c6dcb8248 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sat, 6 Apr 2019 05:35:07 -0400 Subject: [PATCH] [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 --- src/mono/mono/metadata/seq-points-data.c | 5 +++++ 1 file changed, 5 insertions(+) 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); -- 2.7.4