File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -619,6 +619,8 @@ pub enum AmlError {
619
619
UnterminatedStringConstant ,
620
620
InvalidStringConstant ,
621
621
InvalidRegionSpace ( u8 ) ,
622
+ /// Produced when a `DefPackage` contains a different number of elements to the package's length.
623
+ InvalidPackage ,
622
624
/// Emitted by a parser when it's clear that the stream doesn't encode the object parsed by
623
625
/// that parser (e.g. the wrong opcode starts the stream). This is handled specially by some
624
626
/// parsers such as `or` and `choice!`.
Original file line number Diff line number Diff line change @@ -276,7 +276,10 @@ where
276
276
package_contents. push ( value) ;
277
277
}
278
278
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
+
280
283
Ok ( ( input, context, AmlValue :: Package ( package_contents) ) )
281
284
}
282
285
} ) ,
You can’t perform that action at this time.
0 commit comments