Blame SOURCES/0066-fix-rich-limit-table-to-strip-non-printables-to-C0-a.patch

725d6a
From ff6e65737413d54b6f6964f72827a92fdbecc182 Mon Sep 17 00:00:00 2001
725d6a
From: Eric Garver <eric@garver.life>
725d6a
Date: Fri, 8 Jan 2021 13:38:15 -0500
725d6a
Subject: [PATCH 68/68] fix(rich): limit table to strip non-printables to C0
725d6a
 and C1
725d6a
725d6a
Generating the table was taking an unreasonable amount of memory.
725d6a
Stripping C0 and C1 should cover most scenarios while limiting memory
725d6a
usage.
725d6a
725d6a
Fixes: ac5960856991 ("fix(rich): non-printable characters removed from rich rules")
725d6a
(cherry picked from commit 015704b44f81d535a868fe28368f977cefd28638)
725d6a
(cherry picked from commit 629a53ef027146f8e4e486c40c8bde04cda830d3)
725d6a
---
725d6a
 src/firewall/functions.py | 7 ++++++-
725d6a
 1 file changed, 6 insertions(+), 1 deletion(-)
725d6a
725d6a
diff --git a/src/firewall/functions.py b/src/firewall/functions.py
725d6a
index d20b702e047e..1ea9f4309234 100644
725d6a
--- a/src/firewall/functions.py
725d6a
+++ b/src/firewall/functions.py
725d6a
@@ -43,7 +43,12 @@ from firewall.config import FIREWALLD_TEMPDIR, FIREWALLD_PIDFILE
725d6a
 PY2 = sys.version < '3'
725d6a
 
725d6a
 NOPRINT_TRANS_TABLE = {
725d6a
-    i: None for i in range(0, sys.maxunicode + 1) if not chr(i).isprintable()
725d6a
+    # Limit to C0 and C1 code points. Building entries for all unicode code
725d6a
+    # points requires too much memory.
725d6a
+    # C0 = [0, 31]
725d6a
+    # C1 = [127, 159]
725d6a
+    #
725d6a
+    i: None for i in range(0, 160) if not (i > 31 and i < 127)
725d6a
 }
725d6a
 
725d6a
 def getPortID(port):
725d6a
-- 
725d6a
2.27.0
725d6a