File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -619,6 +619,8 @@ pub enum AmlError {
619619 UnterminatedStringConstant ,
620620 InvalidStringConstant ,
621621 InvalidRegionSpace ( u8 ) ,
622+ /// Produced when a `DefPackage` contains a different number of elements to the package's length.
623+ InvalidPackage ,
622624 /// Emitted by a parser when it's clear that the stream doesn't encode the object parsed by
623625 /// that parser (e.g. the wrong opcode starts the stream). This is handled specially by some
624626 /// parsers such as `or` and `choice!`.
Original file line number Diff line number Diff line change @@ -276,7 +276,10 @@ where
276276 package_contents. push ( value) ;
277277 }
278278
279- assert_eq ! ( package_contents. len( ) , num_elements as usize ) ;
279+ if package_contents. len ( ) != num_elements as usize {
280+ return Err ( ( input, context, AmlError :: InvalidPackage ) ) ;
281+ }
282+
280283 Ok ( ( input, context, AmlValue :: Package ( package_contents) ) )
281284 }
282285 } ) ,
You can’t perform that action at this time.
0 commit comments