@@ -796,9 +796,10 @@ oac_int32 test_parse(void) {
796796 UNDEFINE_FOR_PARSE
797797 ret = oac_packet_parse (packet , jj , & toc , frames , size , & payload_offset );
798798 cfgs ++ ;
799- if ((jj & 1 ) == 1 && jj <= 2551 ) {
800- /* Must pass if payload length even (packet length odd) and
801- size<=2551, must fail otherwise. */
799+ if ((jj & 1 ) == 1 ) {
800+ /* Must pass if payload length even (packet length odd),
801+ must fail otherwise. Frame sizes in this loop are well below
802+ the parser limit of 1275*OAC_MAX_CHANNELS. */
802803 if (ret != 2 ) test_failed ();
803804 if (size [0 ] != size [1 ] || size [0 ] != ((jj - 1 )>>1 )) test_failed ();
804805 if (frames [0 ] != packet + 1 ) test_failed ();
@@ -832,11 +833,11 @@ oac_int32 test_parse(void) {
832833 ret = oac_packet_parse (packet , j + (j < 252 ?2 :3 ) - 1 , & toc , frames , size , & payload_offset );
833834 cfgs ++ ;
834835 if (ret != OAC_INVALID_PACKET ) test_failed ();
835- /*Code 2, one too long*/
836+ /*Code 2, one too long (for standard, but within ambisonics limit) */
836837 UNDEFINE_FOR_PARSE
837838 ret = oac_packet_parse (packet , j + (j < 252 ?2 :3 ) + 1276 , & toc , frames , size , & payload_offset );
838839 cfgs ++ ;
839- if (ret != OAC_INVALID_PACKET ) test_failed ();
840+ if (ret != 2 ) test_failed ();
840841 /*Code 2, second zero*/
841842 UNDEFINE_FOR_PARSE
842843 ret = oac_packet_parse (packet , j + (j < 252 ?2 :3 ), & toc , frames , size , & payload_offset );
@@ -913,7 +914,8 @@ oac_int32 test_parse(void) {
913914 UNDEFINE_FOR_PARSE
914915 ret = oac_packet_parse (packet , 1276 + 2 , & toc , frames , size , & payload_offset );
915916 cfgs ++ ;
916- if (ret != OAC_INVALID_PACKET ) test_failed ();
917+ if (ret != 1 ) test_failed ();
918+ if (size [0 ] != 1276 ) test_failed ();
917919 }
918920 fprintf (stdout , " code 3 m=1 CBR (%2d cases) ................. OK.\n" , cfgs );
919921 cfgs_total += cfgs ; cfgs = 0 ;
@@ -929,8 +931,8 @@ oac_int32 test_parse(void) {
929931 UNDEFINE_FOR_PARSE
930932 ret = oac_packet_parse (packet , sz , & toc , frames , size , & payload_offset );
931933 cfgs ++ ;
932- /*Must be <=120ms, must be evenly divisible, can't have frames>1275 bytes*/
933- if (frame_samp * j <= 5760 && (sz - 2 )%j == 0 && (sz - 2 )/j < 1276 ) {
934+ /*Must be <=120ms, must be evenly divisible, can't have frames>1275*OAC_MAX_CHANNELS bytes*/
935+ if (frame_samp * j <= 5760 && (sz - 2 )%j == 0 && (sz - 2 )/j < 1275 * 255 + 1 ) {
934936 if (ret != j ) test_failed ();
935937 for (jj = 1 ; jj < ret ; jj ++ ) if (frames [jj ] != frames [jj - 1 ] + size [jj - 1 ]) test_failed ();
936938 if ((toc >>2 ) != i ) test_failed ();
@@ -1569,10 +1571,10 @@ int test_repacketizer_api(void) {
15691571 for (cnt = 0 ; cnt < maxp + 2 ; cnt ++ ) {
15701572 if (cnt > 0 ) {
15711573 ret = oac_repacketizer_cat (rp , packet , k + (i > 2 ?2 :1 ));
1572- if ((cnt <= maxp && k <= (1275 * i ))?ret != OAC_OK :ret != OAC_INVALID_PACKET ) test_failed ();
1574+ if ((cnt <= maxp && k <= (1275 * 255 * ( oac_int32 ) i ))?ret != OAC_OK :ret != OAC_INVALID_PACKET ) test_failed ();
15731575 cfgs ++ ;
15741576 }
1575- rcnt = k <= (1275 * i )?(cnt < maxp ?cnt :maxp ):0 ;
1577+ rcnt = k <= (1275 * 255 * ( oac_int32 ) i )?(cnt < maxp ?cnt :maxp ):0 ;
15761578 if (oac_repacketizer_get_nb_frames (rp ) != rcnt * i ) test_failed ();
15771579 cfgs ++ ;
15781580 ret = oac_repacketizer_out_range (rp , 0 , rcnt * i , po , max_out );
0 commit comments