From ed09905c340e50342dfd4efc7ecc2b14d42c2fa7 Mon Sep 17 00:00:00 2001 From: cccs-kevin Date: Wed, 10 Apr 2024 13:44:38 +0000 Subject: [PATCH] Protect when mismatch between leading_char_index and length of decoded_match_string --- jsjaws.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsjaws.py b/jsjaws.py index 6a7cb576..4f6d6e6f 100755 --- a/jsjaws.py +++ b/jsjaws.py @@ -875,6 +875,8 @@ def log_and_replace(match) -> bytes: decoded_match_string = match.string.decode() except UnicodeDecodeError: return + if leading_char_index > len(decoded_match_string): + return leading_char = decoded_match_string[leading_char_index] return f"{leading_char}[{property_name}] = {property_value};".encode()