shithub: libmujs

Download patch

ref: 5c1300b015f5b034a8e70b6708c0594274f6de1c
parent: b4297c0dec103a40bc1fc12792610d053fdd2bff
author: Tor Andersson <tor.andersson@artifex.com>
date: Thu Jul 26 19:44:15 EDT 2018

Fix 699559: Off-by-one comparison in regexp parser.

--- a/regexp.c
+++ b/regexp.c
@@ -481,7 +481,7 @@
 	}
 	if (g->lookahead == L_REF) {
 		atom = newnode(g, P_REF);
-		if (g->yychar == 0 || g->yychar > g->nsub || !g->sub[g->yychar])
+		if (g->yychar == 0 || g->yychar >= g->nsub || !g->sub[g->yychar])
 			die(g, "invalid back-reference");
 		atom->n = g->yychar;
 		atom->x = g->sub[g->yychar];