File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -2039,7 +2039,7 @@ fn read_ipma<T: Read>(
2039
2039
fn read_ipco < T : Read > ( src : & mut BMFFBox < T > ) -> Result < TryHashMap < u16 , ItemProperty > > {
2040
2040
let mut properties = TryHashMap :: with_capacity ( 1 ) ?;
2041
2041
2042
- let mut index = 1 ; // ipma uses 1-based indexing
2042
+ let mut index: u16 = 1 ; // ipma uses 1-based indexing
2043
2043
let mut iter = src. box_iter ( ) ;
2044
2044
while let Some ( mut b) = iter. next_box ( ) ? {
2045
2045
if let Some ( property) = match b. head . name {
@@ -2053,7 +2053,9 @@ fn read_ipco<T: Read>(src: &mut BMFFBox<T>) -> Result<TryHashMap<u16, ItemProper
2053
2053
properties. insert ( index, property) ?;
2054
2054
}
2055
2055
2056
- index += 1 ; // must include ignored properties to have correct indexes
2056
+ index = index
2057
+ . checked_add ( 1 ) // must include ignored properties to have correct indexes
2058
+ . ok_or ( Error :: InvalidData ( "ipco index overflow" ) ) ?;
2057
2059
2058
2060
check_parser_state ! ( b. content) ;
2059
2061
}
You can’t perform that action at this time.
0 commit comments