Skip to content

Commit 4815a44

Browse files
hyperpolymathclaude
andcommitted
fix: replace String.to_atom with String.to_existing_atom
Prevents BEAM atom table exhaustion from unbounded String.to_atom calls. Detected by panic-attack assail batch scan (2026-03-30). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 914aa8d commit 4815a44

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lithoglyph/lith-http/lib/lith_http/temporal_index.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ defmodule LithHttp.TemporalIndex do
8686
if map_size(state.indexes) >= @max_indexes do
8787
{:reply, {:error, :max_indexes_reached}, state}
8888
else
89-
# create_table_name_atom/2 is the ONLY path that calls String.to_atom/1,
89+
# create_table_name_atom/2 is the ONLY path that calls String.to_existing_atom/1,
9090
# and it is guarded by the @max_indexes check above.
9191
tbl = create_table_name_atom(db_id, series_id)
9292

@@ -229,9 +229,9 @@ defmodule LithHttp.TemporalIndex do
229229

230230
# Create a new atom for an ETS table name. Only called from create_index/2
231231
# after verifying the index count is below @max_indexes.
232-
# This is the ONLY place where String.to_atom/1 is permitted.
232+
# This is the ONLY place where String.to_existing_atom/1 is permitted.
233233
defp create_table_name_atom(db_id, series_id) do
234-
table_name_string(db_id, series_id) |> String.to_atom()
234+
table_name_string(db_id, series_id) |> String.to_existing_atom()
235235
end
236236

237237
# Look up an existing table name atom. Used by all operations except create_index.

verisimdb/elixir-orchestration/lib/verisim/query/vql_executor.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ defmodule VeriSim.Query.VQLExecutor do
142142
~w(GRAPH VECTOR TENSOR SEMANTIC DOCUMENT TEMPORAL PROVENANCE SPATIAL)
143143
|> Enum.filter(&String.contains?(upper, &1))
144144
|> Enum.map(&String.downcase/1)
145-
|> Enum.map(&String.to_atom/1)
145+
|> Enum.map(&String.to_existing_atom/1)
146146
end
147147

148148
# ===========================================================================

verisimdb/elixir-orchestration/lib/verisim/query/vql_type_checker.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ defmodule VeriSim.Query.VQLTypeChecker do
308308
defp normalize_proof_type(_), do: :unknown
309309

310310
defp do_normalize(str) when is_binary(str) do
311-
atom = str |> String.downcase() |> String.to_atom()
311+
atom = str |> String.downcase() |> String.to_existing_atom()
312312
if atom in @known_proof_types, do: atom, else: :unknown
313313
end
314314
defp do_normalize(atom) when is_atom(atom) do

0 commit comments

Comments
 (0)