summaryrefslogtreecommitdiff
path: root/framebuffer
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-08-18 17:15:57 +0100
committerVincent Sanders <vince@kyllikki.org>2014-08-18 17:15:57 +0100
commit1a71a84b6268bd24a306f7bad87cdd88c2d95e78 (patch)
treebf7146cd9a72d989f37fa43d0572238d2a63cbad /framebuffer
parent984d87985ca41fed68c41da3c787924178bc4c14 (diff)
downloadnetsurf-1a71a84b6268bd24a306f7bad87cdd88c2d95e78.tar.gz
netsurf-1a71a84b6268bd24a306f7bad87cdd88c2d95e78.tar.bz2
cope with error return from ftell (coverity 1231843)
Diffstat (limited to 'framebuffer')
-rw-r--r--framebuffer/convert_font.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/framebuffer/convert_font.c b/framebuffer/convert_font.c
index a43b31d7d..7c7a16a4f 100644
--- a/framebuffer/convert_font.c
+++ b/framebuffer/convert_font.c
@@ -2,19 +2,26 @@
* Copyright 2014 Michael Drake <tlsa@netsurf-browser.org>
* Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
*
- * This file is part of NetSurf, http://www.netsurf-browser.org/
+ * This file is part of the convert_font tool used to convert font
+ * glyph data into a compilable representation.
*
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
*
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
*/
#include <stdbool.h>
@@ -1031,6 +1038,12 @@ bool load_font(const char *path, struct font_data **data)
/* Find filesize */
fseek(fp, 0L, SEEK_END);
file_len = ftell(fp);
+ if (file_len == -1) {
+ LOG(LOG_ERROR, "Could not size input file\n");
+ free(d);
+ fclose(fp);
+ return false;
+ }
fseek(fp, 0L, SEEK_SET);
LOG(LOG_DEBUG, "Input size: %zu bytes\n", file_len);