From 00917f1f752ff58d3c5f87db277cb3487021da46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leon=20Wei=C3=9F?= <leon.weiss@rub.de>
Date: Mon, 14 Aug 2023 21:30:10 +0200
Subject: [PATCH] Add env var to customize max clamped jump table size

---
 irdb-libs/ir_builders/fill_in_indtargs.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/irdb-libs/ir_builders/fill_in_indtargs.cpp b/irdb-libs/ir_builders/fill_in_indtargs.cpp
index 5187bbca0..be4018949 100644
--- a/irdb-libs/ir_builders/fill_in_indtargs.cpp
+++ b/irdb-libs/ir_builders/fill_in_indtargs.cpp
@@ -2676,6 +2676,12 @@ V2:
 		// cannot find a bounds check on the table size.
 		//
 		auto table_size = 512U;
+        if(getenv("MAX_JUMP_TABLE_CLAMP_SIZE")){
+            auto temp_table_size = atoi(getenv("MAX_JUMP_TABLE_CLAMP_SIZE"));
+            if(temp_table_size > 0){
+                table_size = temp_table_size;
+            }
+        }
 		auto found_table_size = false;
 		auto I1 = static_cast<Instruction_t *>(nullptr);
 
-- 
GitLab