mujs/0003-Issue-161-Cope-with-empty-programs-in-mujs-pp.patch
leeffo e9d9c58dc3 fix CVE-2022-30974 CVE-2022-30975
(cherry picked from commit 00909060aee6fdf2577bf1576131a73a9829329b)
2022-09-27 10:48:22 +08:00

55 lines
1.1 KiB
Diff

From f5b3c703e18725e380b83427004632e744f85a6f Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor.andersson@artifex.com>
Date: Tue, 17 May 2022 15:57:00 +0200
Subject: [PATCH 3/3] Issue #161: Cope with empty programs in mujs-pp.
---
jsdump.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/jsdump.c b/jsdump.c
index 86361e6..42c9f0f 100644
--- a/jsdump.c
+++ b/jsdump.c
@@ -682,11 +682,13 @@ static void pstmlist(int d, js_Ast *list)
void jsP_dumpsyntax(js_State *J, js_Ast *prog, int dominify)
{
minify = dominify;
- if (prog->type == AST_LIST)
- pstmlist(-1, prog);
- else {
- pstm(0, prog);
- nl();
+ if (prog) {
+ if (prog->type == AST_LIST)
+ pstmlist(-1, prog);
+ else {
+ pstm(0, prog);
+ nl();
+ }
}
if (minify > 1)
putchar('\n');
@@ -768,11 +770,13 @@ static void sblock(int d, js_Ast *list)
void jsP_dumplist(js_State *J, js_Ast *prog)
{
minify = 0;
- if (prog->type == AST_LIST)
- sblock(0, prog);
- else
- snode(0, prog);
- nl();
+ if (prog) {
+ if (prog->type == AST_LIST)
+ sblock(0, prog);
+ else
+ snode(0, prog);
+ nl();
+ }
}
/* Compiled code */
--
2.20.1