shithub: libmujs

Download patch

ref: fcf0e3ebd7a6b2aed5b218a594acdacdf2690e85
parent: 245a6f97e6b62ebf8a0018d38c5332fae68462b8
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Nov 26 05:39:37 EST 2018

Tweak numeric overflow check in regexp count parser.

--- a/regexp.c
+++ b/regexp.c
@@ -156,9 +156,9 @@
 	while (g->yychar != ',' && g->yychar != '}') {
 		g->yymin = g->yymin * 10 + dec(g, g->yychar);
 		g->yychar = *g->source++;
+		if (g->yymin >= REPINF)
+			die(g, "numeric overflow");
 	}
-	if (g->yymin < 0 || g->yymin >= REPINF)
-		die(g, "numeric overflow");
 
 	if (g->yychar == ',') {
 		g->yychar = *g->source++;
@@ -170,9 +170,9 @@
 			while (g->yychar != '}') {
 				g->yymax = g->yymax * 10 + dec(g, g->yychar);
 				g->yychar = *g->source++;
+				if (g->yymax >= REPINF)
+					die(g, "numeric overflow");
 			}
-			if (g->yymax < 0 || g->yymax >= REPINF)
-				die(g, "numeric overflow");
 		}
 	} else {
 		g->yymax = g->yymin;