shithub: libmujs

Download patch

ref: 4792d16f17b15a1eca3c2a9c856dc13fda1d23c5
parent: ae54eaa65289a39b74009b911fe8542a1a0a62ca
author: Tor Andersson <tor.andersson@artifex.com>
date: Wed Jul 5 09:37:40 EDT 2017

Fix 698191: don't call pexp with NULL expression in jsdump.c

--- a/jsdump.c
+++ b/jsdump.c
@@ -519,16 +519,16 @@
 
 	case STM_FOR:
 		ps("for (");
-		pexp(d, stm->a); ps("; ");
-		pexp(d, stm->b); ps("; ");
-		pexp(d, stm->c); ps(")");
+		if (stm->a) pexp(d, stm->a); ps("; ");
+		if (stm->b) pexp(d, stm->b); ps("; ");
+		if (stm->c) pexp(d, stm->c); ps(")");
 		pstmh(d, stm->d);
 		break;
 	case STM_FOR_VAR:
 		ps("for (var ");
 		pvarlist(d, stm->a); ps("; ");
-		pexp(d, stm->b); ps("; ");
-		pexp(d, stm->c); ps(")");
+		if (stm->b) pexp(d, stm->b); ps("; ");
+		if (stm->c) pexp(d, stm->c); ps(")");
 		pstmh(d, stm->d);
 		break;
 	case STM_FOR_IN: