File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -260,7 +260,9 @@ impl Depacketizer for H264Depacketizer {
260
260
) ) ;
261
261
}
262
262
263
- let b0 = packet[ curr_offset] ;
263
+ let Some ( b0) = packet. get ( curr_offset) else {
264
+ continue ;
265
+ } ;
264
266
let t = b0 & NALU_TYPE_BITMASK ;
265
267
let is_keyframe = if let CodecExtra :: H264 ( e) = extra {
266
268
( t == IDR_NALU_TYPE ) | e. is_keyframe
@@ -755,4 +757,14 @@ mod test {
755
757
let mut out = vec ! [ ] ;
756
758
pck. depacketize ( PACKET , & mut out, & mut extra) . unwrap ( ) ;
757
759
}
760
+
761
+ #[ test]
762
+ fn test_out_of_bounds_access ( ) {
763
+ const PACKET : & [ u8 ] = & [ STAPA_NALU_TYPE , 0x00 , 0x00 ] ;
764
+
765
+ let mut pck = H264Depacketizer :: default ( ) ;
766
+ let mut extra = CodecExtra :: None ;
767
+ let mut out = vec ! [ ] ;
768
+ pck. depacketize ( PACKET , & mut out, & mut extra) . unwrap ( ) ;
769
+ }
758
770
}
You can’t perform that action at this time.
0 commit comments