ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-BER-XS/XS.xs
(Generate patch)

Comparing Convert-BER-XS/XS.xs (file contents):
Revision 1.30 by root, Tue Apr 23 20:03:08 2019 UTC vs.
Revision 1.31 by root, Tue Apr 23 21:03:12 2019 UTC

470 if (tag == ASN_TAG_BER) 470 if (tag == ASN_TAG_BER)
471 tag = get_w (); 471 tag = get_w ();
472 472
473 if (constructed) 473 if (constructed)
474 { 474 {
475 UV len = get_length (); 475 want (1);
476 UV seqend = (cur - buf) + len;
477 AV *av = (AV *)sv_2mortal ((SV *)newAV ()); 476 AV *av = (AV *)sv_2mortal ((SV *)newAV ());
478 477
479 while (cur < buf + seqend) 478 if (expect_false (*cur == 0x80))
479 {
480 // indefinite length
481 ++cur;
482
483 for (;;)
484 {
485 want (2);
486 if (!cur [0] && !cur [1])
487 {
488 cur += 2;
489 break;
490 }
491
480 av_push (av, decode_ber ()); 492 av_push (av, decode_ber ());
493 }
494 }
495 else
496 {
497 UV len = get_length ();
498 UV seqend = (cur - buf) + len;
481 499
500 while (cur < buf + seqend)
501 av_push (av, decode_ber ());
502
482 if (expect_false (cur > buf + seqend)) 503 if (expect_false (cur > buf + seqend))
483 croak ("CONSTRUCTED type %02x length overflow (0x%x 0x%x)\n", identifier, (int)(cur - buf), (int)seqend); 504 croak ("CONSTRUCTED type %02x length overflow (0x%x 0x%x)\n", identifier, (int)(cur - buf), (int)seqend);
505 }
484 506
485 res = newRV_inc ((SV *)av); 507 res = newRV_inc ((SV *)av);
486 } 508 }
487 else 509 else
488 { 510 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines