shithub: libmujs

Download patch

ref: 7e40d3fefd100aa948fa1ed8bf900fea73d4df9c
parent: effc3ae9ad351c53f4b3ecba8669464e4a97c8c2
author: Tor Andersson <tor@ccxvii.net>
date: Fri Jan 10 11:55:36 EST 2014

Ensure that we can seek in the file in js_loadfile.

--- a/jsload.c
+++ b/jsload.c
@@ -25,10 +25,14 @@
 	int n, t;
 
 	f = fopen(filename, "r");
-	if (!f)
+	if (!f) {
 		return js_error(J, "cannot open file: '%s'", filename);
+	}
 
-	fseek(f, 0, SEEK_END);
+	if (fseek(f, 0, SEEK_END) < 0) {
+		fclose(f);
+		return js_error(J, "cannot seek in file: '%s'", filename);
+	}
 	n = ftell(f);
 	fseek(f, 0, SEEK_SET);
 
--- a/jsparse.h
+++ b/jsparse.h
@@ -52,8 +52,8 @@
 	EXP_NEG,
 	EXP_BITNOT,
 	EXP_LOGNOT,
-	EXP_LOGOR,
 
+	EXP_LOGOR,
 	EXP_LOGAND,
 	EXP_BITOR,
 	EXP_BITXOR,