fixed bug with color layering issue
Some checks failed
CI / Lint and Test (pull_request) Successful in 44s
CI / Version Check (pull_request) Failing after 3s

This commit is contained in:
2026-03-31 12:18:53 +02:00
parent 69d0269270
commit 7c8ecda29a
11 changed files with 126 additions and 51 deletions

View File

@@ -12,7 +12,9 @@ use crate::types::{ResolvedDesign, StitchCommand};
///
/// Byte order: mixed, but length-prefixed strings and section sizes use big-endian.
/// Stitch encoding: variable-length (1 byte for small moves, 3 bytes for large).
pub fn parse(data: &[u8]) -> Result<(Vec<StitchCommand>, Vec<(u8, u8, u8)>), Error> {
type ParseResult = Result<(Vec<StitchCommand>, Vec<(u8, u8, u8)>), Error>;
pub fn parse(data: &[u8]) -> ParseResult {
if data.len() < 20 {
return Err(Error::TooShort {
expected: 20,
@@ -93,10 +95,11 @@ fn skip_vp3_header(reader: &mut Reader) -> Result<(), Error> {
// Skip another potential string
if reader.remaining() >= 2 {
let peek = reader.peek_u16_be();
if let Ok(len) = peek {
if len < 1000 && (len as usize) + 2 <= reader.remaining() {
skip_string(reader)?;
}
if let Ok(len) = peek
&& len < 1000
&& (len as usize) + 2 <= reader.remaining()
{
skip_string(reader)?;
}
}