[librsvg: 4/32] Use LoadingError::LimitExceeded when too many XML elements are loaded
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 4/32] Use LoadingError::LimitExceeded when too many XML elements are loaded
- Date: Fri, 4 Dec 2020 21:11:30 +0000 (UTC)
commit 7c8a404bec963de90eb11112012b416915cad664
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Nov 25 11:40:59 2020 -0600
Use LoadingError::LimitExceeded when too many XML elements are loaded
Instead of shoehorning that error into a LoadingError::XmlParseError -
it is not a parse error; it is an implementation-defined limit.
src/xml/mod.rs | 2 +-
tests/src/errors.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/xml/mod.rs b/src/xml/mod.rs
index 6a1727cc..ac581e23 100644
--- a/src/xml/mod.rs
+++ b/src/xml/mod.rs
@@ -160,7 +160,7 @@ impl XmlState {
fn check_limits(&self) -> Result<(), ()> {
if self.inner.borrow().num_loaded_elements > MAX_LOADED_ELEMENTS {
- self.error(LoadingError::XmlParseError(format!(
+ self.error(LoadingError::LimitExceeded(format!(
"cannot load more than {} XML elements",
MAX_LOADED_ELEMENTS
)));
diff --git a/tests/src/errors.rs b/tests/src/errors.rs
index 71327cf1..19ce3578 100644
--- a/tests/src/errors.rs
+++ b/tests/src/errors.rs
@@ -20,7 +20,7 @@ fn too_many_elements() {
assert!(matches!(
Loader::new().read_path(name),
- Err(LoadingError::XmlParseError(_))
+ Err(LoadingError::LimitExceeded(_))
));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]