@@ -823,6 +823,10 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
823
823
i , inp [i ].pi_id , inp [i ].pi_type , q - p , offs ));
824
824
if (inp [i ].pi_type & CDF_VECTOR ) {
825
825
nelements = CDF_GETUINT32 (q , 1 );
826
+ if (nelements == 0 ) {
827
+ DPRINTF (("CDF_VECTOR with nelements == 0\n" ));
828
+ goto out ;
829
+ }
826
830
o = 2 ;
827
831
} else {
828
832
nelements = 1 ;
@@ -897,7 +901,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
897
901
}
898
902
DPRINTF (("nelements = %" SIZE_T_FORMAT "u\n" ,
899
903
nelements ));
900
- for (j = 0 ; j < nelements ; j ++ , i ++ ) {
904
+ for (j = 0 ; j < nelements && i < sh .sh_properties ;
905
+ j ++ , i ++ )
906
+ {
901
907
uint32_t l = CDF_GETUINT32 (q , o );
902
908
inp [i ].pi_str .s_len = l ;
903
909
inp [i ].pi_str .s_buf = (const char * )
942
948
cdf_unpack_summary_info (const cdf_stream_t * sst , const cdf_header_t * h ,
943
949
cdf_summary_info_header_t * ssi , cdf_property_info_t * * info , size_t * count )
944
950
{
945
- size_t i , maxcount ;
951
+ size_t maxcount ;
946
952
const cdf_summary_info_header_t * si =
947
953
CAST (const cdf_summary_info_header_t * , sst -> sst_tab );
948
954
const cdf_section_declaration_t * sd =
@@ -957,21 +963,13 @@ cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
957
963
ssi -> si_os = CDF_TOLE2 (si -> si_os );
958
964
ssi -> si_class = si -> si_class ;
959
965
cdf_swap_class (& ssi -> si_class );
960
- ssi -> si_count = CDF_TOLE2 (si -> si_count );
966
+ ssi -> si_count = CDF_TOLE4 (si -> si_count );
961
967
* count = 0 ;
962
968
maxcount = 0 ;
963
969
* info = NULL ;
964
- for (i = 0 ; i < CDF_TOLE4 (si -> si_count ); i ++ ) {
965
- if (i >= CDF_LOOP_LIMIT ) {
966
- DPRINTF (("Unpack summary info loop limit" ));
967
- errno = EFTYPE ;
970
+ if (cdf_read_property_info (sst , h , CDF_TOLE4 (sd -> sd_offset ), info ,
971
+ count , & maxcount ) == -1 )
968
972
return -1 ;
969
- }
970
- if (cdf_read_property_info (sst , h , CDF_TOLE4 (sd -> sd_offset ),
971
- info , count , & maxcount ) == -1 ) {
972
- return -1 ;
973
- }
974
- }
975
973
return 0 ;
976
974
}
977
975
0 commit comments