Skip to content

Commit c960238

Browse files
xylarCopilot
andauthored
Add check for too many colons
Co-authored-by: Copilot <[email protected]>
1 parent 3c019f2 commit c960238

File tree

1 file changed

+3
-0
lines changed
  • conda_package/mpas_tools/viz/mpas_to_xdmf

1 file changed

+3
-0
lines changed

conda_package/mpas_tools/viz/mpas_to_xdmf/io.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ def _parse_indices(index_string, dim_size):
302302
if ':' in index_string:
303303
# Support slice notation like ':', '0:10', '0:10:2', etc.
304304
parts = index_string.split(':')
305+
# Validate that parts has at most 3 elements
306+
if len(parts) > 3:
307+
raise ValueError(f"Invalid index string '{index_string}': too many colons. Expected at most two colons.")
305308
# Pad parts to length 3 with empty strings if needed
306309
while len(parts) < 3:
307310
parts.append('')

0 commit comments

Comments
 (0)