We have a rather complex XML parser written with quick-xml that started failing some tests while trying to update from quick-xml 0.39.0 to 0.39.1. The old version did successful parse the document, the new version returned an error.
I minimized both the data and the code down to the following example:
pub mod bml {
use super::*;
#[derive(Debug, Clone, serde::Deserialize)]
pub struct BoreholeType {
#[serde(rename = "boreholeSegment")]
pub borehole_segment: Vec<bml::BoreholeSegmentPropertyType>,
#[serde(rename = "drillingProcess")]
pub drilling_process: Option<Vec<DrillingProcess>>,
}
#[derive(Debug, Clone, serde::Deserialize)]
pub struct BoreholeSegmentType {}
#[derive(Debug, Clone, serde::Deserialize)]
pub struct DrillingProcess {
#[serde(rename = "DrillingProcess")]
pub drilling_process: bml::DrillingProcessType,
}
#[derive(Debug, Clone, serde::Deserialize)]
pub struct DrillingProcessType {
#[serde(rename = "to")]
pub to: gml::LengthType,
}
#[derive(Debug, Clone, serde::Deserialize)]
pub struct BoreholeSegmentPropertyType {
#[serde(rename = "BoreholeSegment")]
pub borehole_segment: bml::BoreholeSegmentType,
}
}
pub mod gml {
#[derive(Debug, Clone, serde::Deserialize)]
pub struct LengthType {
#[serde(rename = "$value")]
pub value: Option<f64>,
}
}
fn main() {
let input = r#"
<?xml version='1.0' encoding='UTF-8'?>
<bml:Borehole xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/deprecatedTypes.xsd http://www.infogeo.de/boreholeml/3.0 https://www.infogeo.de/boreholeml/3.0/BoreholeML.xsd" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:bml="http://www.infogeo.de/boreholeml/3.0">
<bml:boreholeSegment>
<bml:BoreholeSegment>
<bml:from>0.0</bml:from>
</bml:BoreholeSegment>
</bml:boreholeSegment>
<bml:drillingProcess xsi:nil="true"/>
</bml:Borehole>
"#;
let res = quick_xml::de::from_str::<bml::BoreholeType>(&input);
assert!(res.is_ok(), "Error: {}", res.unwrap_err());
}
With that I run git bisect against all revisions between the 0.39.0 and the 0.39.1 tag. This reported 210d3e1 as the first failing commit.
For me this looks like something around the parsing of xsi:nil="true" must have changed there as the parser now tries to parse inner fields of a null value.
We have a rather complex XML parser written with
quick-xmlthat started failing some tests while trying to update fromquick-xml0.39.0 to 0.39.1. The old version did successful parse the document, the new version returned an error.I minimized both the data and the code down to the following example:
With that I run
git bisectagainst all revisions between the 0.39.0 and the 0.39.1 tag. This reported 210d3e1 as the first failing commit.For me this looks like something around the parsing of
xsi:nil="true"must have changed there as the parser now tries to parse inner fields of a null value.