From 509a1f1fd6fb2b6655bc4597953403c70f95f929 Mon Sep 17 00:00:00 2001 From: James S Klassen Date: Sat, 13 Jun 2026 20:50:03 -0500 Subject: [PATCH 1/3] Fix encoding declaration. UTF-8 is invalid. Proper is utf-8. --- lib/filter_scene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/filter_scene.py b/lib/filter_scene.py index 053743b..c195df8 100644 --- a/lib/filter_scene.py +++ b/lib/filter_scene.py @@ -1,4 +1,4 @@ -# -*- coding: UTF-8 -*- +# -*- coding: utf-8 -*- # Version 3.1; Erik Husby, Ryan Shellberg; Polar Geospatial Center, University of Minnesota; 2019 # Translated from MATLAB code written by Ian Howat, Ohio State University, 2018 From 08ff52762606799de886da71d57f057b22bc6bc3 Mon Sep 17 00:00:00 2001 From: James S Klassen Date: Sat, 13 Jun 2026 20:51:00 -0500 Subject: [PATCH 2/3] Ignore namespaces in Vantor XML metadata. --- lib/filter_scene.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/filter_scene.py b/lib/filter_scene.py index c195df8..0f03751 100644 --- a/lib/filter_scene.py +++ b/lib/filter_scene.py @@ -1882,7 +1882,8 @@ def readFromXml(xmlFile, xml_paramstrs): while line != '' and None in values: for ps in xml_paramstrs_left: if ps in line: - values[xml_paramstrs.index(ps)] = line.replace("<{}>".format(ps), '').replace("".format(ps), '') + regex = "<([^:]*:){0,1}"+ps+">(.*)" + values[xml_paramstrs.index(ps)] = re.sub(regex, r"\2", line) xml_paramstrs_left.remove(ps) break xmlFile_fp.close() From 82916b74a33a1609ee9f94538963aa46aa312fea Mon Sep 17 00:00:00 2001 From: James S Klassen Date: Tue, 16 Jun 2026 10:23:03 -0500 Subject: [PATCH 3/3] Make sure XML tag name is valid before building regex. And is not going to cause regex injection issues. This isn't a problem given the current call tree, but this is good defensive coding. --- lib/filter_scene.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/filter_scene.py b/lib/filter_scene.py index 0f03751..c5f8280 100644 --- a/lib/filter_scene.py +++ b/lib/filter_scene.py @@ -1882,6 +1882,8 @@ def readFromXml(xmlFile, xml_paramstrs): while line != '' and None in values: for ps in xml_paramstrs_left: if ps in line: + if not re.match(r"^[A-Za-z0-9-_\.]+$", ps): + raise InvalidArgumentError(f"Error: Illegal XML tag name: {ps}") regex = "<([^:]*:){0,1}"+ps+">(.*)" values[xml_paramstrs.index(ps)] = re.sub(regex, r"\2", line) xml_paramstrs_left.remove(ps)