Implement MeshFoundry pipeline (#77)
Some checks failed
Native code generation / deterministic (push) Failing after 1m58s
Imaging and meshing gate / native (push) Failing after 4m10s
JPEG 2000 feature / linux (push) Successful in 3m0s
Native Rust workspace compile / compile (push) Failing after 6m12s
Skia feature / linux (push) Has been cancelled

This commit is contained in:
2026-08-10 22:37:43 +00:00
parent 611db567a0
commit 88408c9680
17 changed files with 2402 additions and 50 deletions

View File

@@ -21,10 +21,14 @@ const fn is_binary_whitespace(byte: u8) -> bool {
}
pub(crate) fn deserialize_bytes(data: Vec<u8>) -> Result<OSD, Error> {
deserialize_prefix(&data).map(|(value, _)| value)
}
pub(crate) fn deserialize_prefix(data: &[u8]) -> Result<(OSD, usize), Error> {
if data.len() > MAX_INPUT_BYTES {
return Err(parse_error(0, "binary LLSD input exceeds allocation limit"));
}
let mut parser = Parser::new(&data);
let mut parser = Parser::new(data);
parser.skip_whitespace();
if parser.consume_prefix_ignore_ascii_case(ALT_HEADER)
|| parser.consume_prefix_ignore_ascii_case(HEADER)
@@ -37,7 +41,7 @@ pub(crate) fn deserialize_bytes(data: Vec<u8>) -> Result<OSD, Error> {
OSD::DEFAULT_MAX_NODES,
OSD::DEFAULT_MAX_BINARY_BYTES,
)?;
Ok(value)
Ok((value, parser.position))
}
pub(crate) fn deserialize_stream(mut stream: Box<dyn ReadWrite + Send>) -> Result<OSD, Error> {
@@ -596,6 +600,18 @@ mod tests {
);
}
#[test]
fn prefix_decode_reports_exact_payload_boundary() {
let value = OSD::Map(HashMap::from([("offset".into(), OSD::Integer(7))]));
let encoded = serialize_with_header(value.clone(), false).unwrap();
let mut container = encoded.clone();
container.extend_from_slice(b"\x78\x9c appended payload");
let (decoded, consumed) = deserialize_prefix(&container).unwrap();
assert_eq!(decoded, value);
assert_eq!(consumed, encoded.len());
assert_eq!(&container[consumed..], b"\x78\x9c appended payload");
}
#[test]
fn malformed_seed_corpus_is_rejected_with_positions() {
let expected: &[(&str, &str)] = &[

View File

@@ -54,3 +54,15 @@ pub mod xml {
pub use generated::*;
pub use libremetaverse_types as types;
pub use libremetaverse_types::Error;
/// Decodes one bounded binary LLSD value and returns the number of consumed
/// bytes, allowing native container formats to locate payloads appended after
/// an LLSD header without duplicating the codec.
///
/// # Errors
///
/// Returns a positioned parse error when the prefix is malformed, truncated,
/// or exceeds the shared LLSD depth, node, input, or allocation bounds.
pub fn deserialize_llsd_binary_prefix(data: &[u8]) -> Result<(OSD, usize), Error> {
binary::deserialize_prefix(data)
}