@@ -1301,6 +1301,8 @@ int oapve_encode(oapve_t eid, oapv_frms_t *ifrms, oapvm_t mid, oapv_bitb_t *bitb
13011301 oapv_bs_t bs_pbu_beg ;
13021302 oapv_bsw_write (bs , 0 , 32 );
13031303
1304+ oapv_bsw_write (bs , 0x61507631 , 32 ); // signature ('aPv1')
1305+
13041306 for (i = 0 ; i < ifrms -> num_frms ; i ++ ) {
13051307 frm = & ifrms -> frm [i ];
13061308
@@ -1953,6 +1955,13 @@ int oapvd_decode(oapvd_t did, oapv_bitb_t *bitb, oapv_frms_t *ofrms, oapvm_t mid
19531955 ctx = dec_id_to_ctx (did );
19541956 oapv_assert_rv (ctx , OAPV_ERR_INVALID_ARGUMENT );
19551957
1958+ // read signature ('aPv1')
1959+ oapv_assert_rv (bitb -> ssize > 4 , OAPV_ERR_MALFORMED_BITSTREAM );
1960+ u32 signature = oapv_bsr_read_direct (bitb -> addr , 32 );
1961+ oapv_assert_rv (signature == 0x61507631 , OAPV_ERR_MALFORMED_BITSTREAM );
1962+ cur_read_size += 4 ;
1963+ stat -> read += 4 ;
1964+
19561965 do {
19571966 u32 remain = bitb -> ssize - cur_read_size ;
19581967 oapv_assert_gv ((remain >= 8 ), ret , OAPV_ERR_MALFORMED_BITSTREAM , ERR );
@@ -2065,6 +2074,12 @@ int oapvd_info(void *au, int au_size, oapv_au_info_t *aui)
20652074
20662075 DUMP_SET (0 );
20672076
2077+ // read signature ('aPv1')
2078+ oapv_assert_rv (au_size > 4 , OAPV_ERR_MALFORMED_BITSTREAM );
2079+ u32 signature = oapv_bsr_read_direct (au , 32 );
2080+ oapv_assert_rv (signature == 0x61507631 , OAPV_ERR_MALFORMED_BITSTREAM );
2081+ cur_read_size += 4 ;
2082+
20682083 /* 'au' address contains series of PBU */
20692084 do {
20702085 oapv_bs_t bs ;
0 commit comments