shithub: libmujs

Download patch

ref: 0ac4cce8b0cb0f052c871576b4fb394b414504a7
parent: 720aec8cd4e92f3cbfd3e4d0fb3b463ecedffba7
author: Tor Andersson <tor.andersson@artifex.com>
date: Fri Jan 2 08:39:11 EST 2015

Fix bound checks in jsdump.

--- a/jsdump.c
+++ b/jsdump.c
@@ -17,16 +17,16 @@
 
 const char *jsP_aststring(enum js_AstType type)
 {
-	if (type > nelem(astname))
-		return "<unknown>";
-	return astname[type];
+	if (type < nelem(astname))
+		return astname[type];
+	return "<unknown>";
 }
 
 const char *jsC_opcodestring(enum js_OpCode opcode)
 {
-	if (opcode > nelem(opname))
-		return "<unknown>";
-	return opname[opcode];
+	if (opcode < nelem(opname))
+		return opname[opcode];
+	return "<unknown>";
 }
 
 static int prec(enum js_AstType type)