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.20 by root, Sat Apr 20 17:04:35 2019 UTC vs.
Revision 1.31 by root, Tue Apr 23 21:03:12 2019 UTC

58 ASN_CLASS_SHIFT = 6, 58 ASN_CLASS_SHIFT = 6,
59 59
60 // ASN_APPLICATION SNMP 60 // ASN_APPLICATION SNMP
61 SNMP_IPADDRESS = 0x00, 61 SNMP_IPADDRESS = 0x00,
62 SNMP_COUNTER32 = 0x01, 62 SNMP_COUNTER32 = 0x01,
63 SNMP_GAUGE32 = 0x02,
63 SNMP_UNSIGNED32 = 0x02, 64 SNMP_UNSIGNED32 = 0x02,
64 SNMP_TIMETICKS = 0x03, 65 SNMP_TIMETICKS = 0x03,
65 SNMP_OPAQUE = 0x04, 66 SNMP_OPAQUE = 0x04,
66 SNMP_COUNTER64 = 0x06, 67 SNMP_COUNTER64 = 0x06,
67}; 68};
68 69
70// tlow-level types this module can ecode the above (and more) into
69enum { 71enum {
70 BER_TYPE_BYTES, 72 BER_TYPE_BYTES,
71 BER_TYPE_UTF8, 73 BER_TYPE_UTF8,
72 BER_TYPE_UCS2, 74 BER_TYPE_UCS2,
73 BER_TYPE_UCS4, 75 BER_TYPE_UCS4,
79 BER_TYPE_REAL, 81 BER_TYPE_REAL,
80 BER_TYPE_IPADDRESS, 82 BER_TYPE_IPADDRESS,
81 BER_TYPE_CROAK, 83 BER_TYPE_CROAK,
82}; 84};
83 85
86// tuple array indices
84enum { 87enum {
85 BER_CLASS = 0, 88 BER_CLASS = 0,
86 BER_TAG = 1, 89 BER_TAG = 1,
87 BER_FLAGS = 2, 90 BER_FLAGS = 2,
88 BER_DATA = 3, 91 BER_DATA = 3,
140{ 143{
141 if (!SvOK (profile)) 144 if (!SvOK (profile))
142 return default_profile; 145 return default_profile;
143 146
144 if (!SvROK (profile)) 147 if (!SvROK (profile))
145 croak ("invalid profile"); 148 croak ("Convert::BER::XS::Profile expected");
146 149
147 profile = SvRV (profile); 150 profile = SvRV (profile);
148 151
149 if (SvSTASH (profile) != profile_stash) 152 if (SvSTASH (profile) != profile_stash)
150 croak ("invalid profile object"); 153 croak ("Convert::BER::XS::Profile expected");
151 154
152 return (void *)profile; 155 return (void *)profile;
153} 156}
154 157
155static int 158static int
227} 230}
228 231
229// get_* functions fetch something from the buffer 232// get_* functions fetch something from the buffer
230// decode_* functions use get_* fun ctions to decode ber values 233// decode_* functions use get_* fun ctions to decode ber values
231 234
235// get single octet
236static U8
237get_u8 (void)
238{
239 if (cur == end)
240 error ("unexpected end of message buffer");
241
242 return *cur++;
243}
244
232// get n octets 245// get n octets
233static U8 * 246static U8 *
234get_n (UV count) 247get_n (UV count)
235{ 248{
236 want (count); 249 want (count);
237 U8 *res = cur; 250 U8 *res = cur;
238 cur += count; 251 cur += count;
239 return res; 252 return res;
240} 253}
241 254
242// get single octet
243static U8
244get_u8 (void)
245{
246 if (cur == end)
247 error ("unexpected end of message buffer");
248
249 return *cur++;
250}
251
252// get ber-encoded integer (i.e. pack "w") 255// get ber-encoded integer (i.e. pack "w")
253static UV 256static UV
254get_w (void) 257get_w (void)
255{ 258{
256 UV res = 0; 259 UV res = 0;
259 if (expect_false (c == 0x80)) 262 if (expect_false (c == 0x80))
260 error ("illegal BER padding (X.690 8.1.2.4.2, 8.19.2)"); 263 error ("illegal BER padding (X.690 8.1.2.4.2, 8.19.2)");
261 264
262 for (;;) 265 for (;;)
263 { 266 {
267 if (expect_false (res >> UVSIZE * 8 - 7))
268 error ("BER variable length integer overflow");
269
264 res = (res << 7) | (c & 0x7f); 270 res = (res << 7) | (c & 0x7f);
265 271
266 if (!(c & 0x80)) 272 if (expect_true (!(c & 0x80)))
267 return res; 273 return res;
268 274
269 c = get_u8 (); 275 c = get_u8 ();
270 } 276 }
271} 277}
273static UV 279static UV
274get_length (void) 280get_length (void)
275{ 281{
276 UV res = get_u8 (); 282 UV res = get_u8 ();
277 283
278 if (res & 0x80) 284 if (expect_false (res & 0x80))
279 { 285 {
280 int cnt = res & 0x7f; 286 U8 cnt = res & 0x7f;
287
288 // this genewrates quite ugly code, but the overhead
289 // of copying the bytes for these lengths is probably so high
290 // that a slightly inefficient get_length won't matter.
291
292 if (expect_false (cnt == 0))
293 error ("indefinite BER value lengths not supported");
294
295 if (expect_false (cnt > UVSIZE))
296 error ("BER value length too long (must fit into UV) or BER reserved value in length (X.690 8.1.3.5)");
297
298 want (cnt);
299
281 res = 0; 300 res = 0;
282 301 do
283 switch (cnt) 302 res = (res << 8) | *cur++;
284 { 303 while (--cnt);
285 case 0:
286 error ("indefinite ASN.1 lengths not supported");
287
288 case 0x7f:
289 error ("ASN.1 reserved value in length (X.690 8.1.3.5)");
290
291 default:
292 error ("ASN.1 length too long (only up to 2**64 octets supported)");
293
294 case 8: res = (res << 8) | get_u8 ();
295 case 7: res = (res << 8) | get_u8 ();
296 case 6: res = (res << 8) | get_u8 ();
297 case 5: res = (res << 8) | get_u8 ();
298 case 4: res = (res << 8) | get_u8 ();
299 case 3: res = (res << 8) | get_u8 ();
300 case 2: res = (res << 8) | get_u8 ();
301 case 1: res = (res << 8) | get_u8 ();
302 }
303 } 304 }
304 305
305 return res; 306 return res;
306} 307}
307 308
308static SV * 309static SV *
309decode_int (void) 310decode_int (UV len)
310{ 311{
311 UV len = get_length ();
312
313 if (!len) 312 if (!len)
314 error ("invalid integer length equal to zero (X.690 8.3.1)"); 313 error ("invalid BER_TYPE_INT length zero (X.690 8.3.1)");
315 314
316 U8 *data = get_n (len); 315 U8 *data = get_n (len);
317 316
318 if (expect_false (len > 1)) 317 if (expect_false (len > 1))
319 { 318 {
320 U16 mask = (data [0] << 8) | data [1] & 0xff80; 319 U16 mask = (data [0] << 8) | data [1] & 0xff80;
321 320
322 if (expect_false (mask == 0xff80 || mask == 0x0000)) 321 if (expect_false (mask == 0xff80 || mask == 0x0000))
323 error ("illegal padding in integer (X.690 8.3.2)"); 322 error ("illegal padding in BER_TYPE_INT (X.690 8.3.2)");
324 } 323 }
325 324
326 int negative = data [0] & 0x80; 325 int negative = data [0] & 0x80;
327 326
328 UV val = negative ? -1 : 0; // copy signbit to all bits 327 UV val = negative ? -1 : 0; // copy signbit to all bits
328
329 if (len > UVSIZE + (!negative && !*data))
330 error ("BER_TYPE_INT overflow");
329 331
330 do 332 do
331 val = (val << 8) | *data++; 333 val = (val << 8) | *data++;
332 while (--len); 334 while (--len);
333 335
335 // but that's ok, as perl relies on it as well. 337 // but that's ok, as perl relies on it as well.
336 return negative ? newSViv ((IV)val) : newSVuv (val); 338 return negative ? newSViv ((IV)val) : newSVuv (val);
337} 339}
338 340
339static SV * 341static SV *
340decode_data (void) 342decode_data (UV len)
341{ 343{
342 UV len = get_length ();
343 return newSVpvn ((char *)get_n (len), len); 344 return newSVpvn ((char *)get_n (len), len);
344} 345}
345 346
346// helper for decode_object_identifier 347// helper for decode_object_identifier
347static char * 348static char *
375 376
376 return buf; 377 return buf;
377} 378}
378 379
379static SV * 380static SV *
380decode_oid (int relative) 381decode_oid (UV len, int relative)
381{ 382{
382 UV len = get_length ();
383
384 if (len <= 0) 383 if (len <= 0)
385 { 384 {
386 error ("OBJECT IDENTIFIER length equal to zero"); 385 error ("BER_TYPE_OID length must not be zero");
387 return &PL_sv_undef; 386 return &PL_sv_undef;
388 } 387 }
389 388
390 U8 *end = cur + len; 389 U8 *end = cur + len;
391 UV w = get_w (); 390 UV w = get_w ();
392 391
393 static char oid[MAX_OID_STRLEN]; // static, becaueds too large for stack 392 static char oid[MAX_OID_STRLEN]; // static, because too large for stack
394 char *app = oid; 393 char *app = oid;
395 394
396 if (relative) 395 if (relative)
397 app = write_uv (app, w); 396 app = write_uv (app, w);
397 else
398 {
399 UV w1, w2;
400
398 else if (w < 2 * 40) 401 if (w < 2 * 40)
399 { 402 (w1 = w / 40), (w2 = w % 40);
403 else
404 (w1 = 2), (w2 = w - 2 * 40);
405
400 app = write_uv (app, (U8)w / 40); 406 app = write_uv (app, w1);
401 *app++ = '.'; 407 *app++ = '.';
402 app = write_uv (app, (U8)w % 40);
403 }
404 else
405 {
406 app = write_uv (app, 2); 408 app = write_uv (app, w2);
407 *app++ = '.';
408 app = write_uv (app, w - 2 * 40);
409 } 409 }
410 410
411 while (cur < end) 411 while (cur < end)
412 { 412 {
413 // we assume an oid component is never > 64 digits 413 // we assume an oid component is never > 64 digits
422 return newSVpvn (oid, app - oid); 422 return newSVpvn (oid, app - oid);
423} 423}
424 424
425// TODO: this is unacceptably slow 425// TODO: this is unacceptably slow
426static SV * 426static SV *
427decode_ucs (int chrsize) 427decode_ucs (UV len, int chrsize)
428{ 428{
429 SV *res = NEWSV (0, 0);
430
431 UV len = get_length ();
432
433 if (len & (chrsize - 1)) 429 if (len & (chrsize - 1))
434 croak ("BER_TYPE_UCS has an invalid number of octets (%d)", len); 430 croak ("BER_TYPE_UCS has an invalid number of octets (%d)", len);
431
432 SV *res = NEWSV (0, 0);
435 433
436 while (len) 434 while (len)
437 { 435 {
438 U8 b1 = get_u8 (); 436 U8 b1 = get_u8 ();
439 U8 b2 = get_u8 (); 437 U8 b2 = get_u8 ();
472 if (tag == ASN_TAG_BER) 470 if (tag == ASN_TAG_BER)
473 tag = get_w (); 471 tag = get_w ();
474 472
475 if (constructed) 473 if (constructed)
476 { 474 {
475 want (1);
476 AV *av = (AV *)sv_2mortal ((SV *)newAV ());
477
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
492 av_push (av, decode_ber ());
493 }
494 }
495 else
496 {
497 UV len = get_length ();
498 UV seqend = (cur - buf) + len;
499
500 while (cur < buf + seqend)
501 av_push (av, decode_ber ());
502
503 if (expect_false (cur > buf + seqend))
504 croak ("CONSTRUCTED type %02x length overflow (0x%x 0x%x)\n", identifier, (int)(cur - buf), (int)seqend);
505 }
506
507 res = newRV_inc ((SV *)av);
508 }
509 else
510 {
477 UV len = get_length (); 511 UV len = get_length ();
478 UV seqend = (cur - buf) + len;
479 AV *av = (AV *)sv_2mortal ((SV *)newAV ());
480 512
481 while (cur < buf + seqend)
482 av_push (av, decode_ber ());
483
484 if (cur > buf + seqend)
485 croak ("constructed type %02x length overflow (0x%x 0x%x)\n", identifier, (int)(cur - buf), (int)seqend);
486
487 res = newRV_inc ((SV *)av);
488 }
489 else
490 switch (profile_lookup (cur_profile, klass, tag)) 513 switch (profile_lookup (cur_profile, klass, tag))
491 { 514 {
492 case BER_TYPE_NULL: 515 case BER_TYPE_NULL:
493 { 516 if (expect_false (len))
494 UV len = get_length ();
495
496 if (len)
497 croak ("BER_TYPE_NULL value with non-zero length %d encountered (X.690 8.8.2)", len); 517 croak ("BER_TYPE_NULL value with non-zero length %d encountered (X.690 8.8.2)", len);
498 518
499 res = &PL_sv_undef; 519 res = &PL_sv_undef;
500 }
501 break; 520 break;
502 521
503 case BER_TYPE_BOOL: 522 case BER_TYPE_BOOL:
504 {
505 UV len = get_length ();
506
507 if (len != 1) 523 if (expect_false (len != 1))
508 croak ("BER_TYPE_BOOLEAN value with invalid length %d encountered (X.690 8.2.1)", len); 524 croak ("BER_TYPE_BOOLEAN value with invalid length %d encountered (X.690 8.2.1)", len);
509 525
510 res = newSVcacheint (!!get_u8 ()); 526 res = newSVcacheint (!!get_u8 ());
511 }
512 break; 527 break;
513 528
514 case BER_TYPE_OID: 529 case BER_TYPE_OID:
515 res = decode_oid (0); 530 res = decode_oid (len, 0);
516 break; 531 break;
517 532
518 case BER_TYPE_RELOID: 533 case BER_TYPE_RELOID:
519 res = decode_oid (1); 534 res = decode_oid (len, 1);
520 break; 535 break;
521 536
522 case BER_TYPE_INT: 537 case BER_TYPE_INT:
523 res = decode_int (); 538 res = decode_int (len);
524 break; 539 break;
525 540
526 case BER_TYPE_UTF8: 541 case BER_TYPE_UTF8:
527 res = decode_data (); 542 res = decode_data (len);
528 SvUTF8_on (res); 543 SvUTF8_on (res);
529 break; 544 break;
530 545
531 case BER_TYPE_BYTES: 546 case BER_TYPE_BYTES:
532 res = decode_data (); 547 res = decode_data (len);
533 break; 548 break;
534 549
535 case BER_TYPE_IPADDRESS: 550 case BER_TYPE_IPADDRESS:
536 { 551 {
537 UV len = get_length ();
538
539 if (len != 4) 552 if (len != 4)
540 croak ("BER_TYPE_IPADDRESS type with invalid length %d encountered (RFC 2578 7.1.5)", len); 553 croak ("BER_TYPE_IPADDRESS type with invalid length %d encountered (RFC 2578 7.1.5)", len);
541 554
542 U8 c1 = get_u8 (); 555 U8 *data = get_n (4);
543 U8 c2 = get_u8 (); 556 res = newSVpvf ("%d.%d.%d.%d", data [0], data [1], data [2], data [3]);
544 U8 c3 = get_u8 ();
545 U8 c4 = get_u8 ();
546
547 res = newSVpvf ("%d.%d.%d.%d", c1, c2, c3, c4);
548 } 557 }
549 break; 558 break;
550 559
551 case BER_TYPE_UCS2: 560 case BER_TYPE_UCS2:
552 res = decode_ucs (2); 561 res = decode_ucs (len, 2);
553 break; 562 break;
554 563
555 case BER_TYPE_UCS4: 564 case BER_TYPE_UCS4:
556 res = decode_ucs (4); 565 res = decode_ucs (len, 4);
557 break; 566 break;
558 567
559 case BER_TYPE_REAL: 568 case BER_TYPE_REAL:
569 error ("BER_TYPE_REAL not implemented");
570
560 case BER_TYPE_CROAK: 571 case BER_TYPE_CROAK:
572 croak ("class/tag %d/%d mapped to BER_TYPE_CROAK", klass, tag);
573
561 default: 574 default:
562 croak ("unconfigured/unsupported class/tag %d/%d", klass, tag); 575 croak ("unconfigured/unsupported class/tag %d/%d", klass, tag);
563 } 576 }
577 }
564 578
565 AV *av = newAV (); 579 AV *av = newAV ();
566 av_fill (av, BER_ARRAYSIZE - 1); 580 av_fill (av, BER_ARRAYSIZE - 1);
567 AvARRAY (av)[BER_CLASS] = newSVcacheint (klass); 581 AvARRAY (av)[BER_CLASS] = newSVcacheint (klass);
568 AvARRAY (av)[BER_TAG ] = newSVcacheint (tag); 582 AvARRAY (av)[BER_TAG ] = newSVcacheint (tag);
655} 669}
656 670
657static U8 * 671static U8 *
658put_length_at (UV val, U8 *cur) 672put_length_at (UV val, U8 *cur)
659{ 673{
660 if (val < 0x7fU) 674 if (val <= 0x7fU)
661 *cur++ = val; 675 *cur++ = val;
662 else 676 else
663 { 677 {
664 U8 *lenb = cur++; 678 U8 *lenb = cur++;
665 679
666#if UVSIZE > 4 680#if UVSIZE > 4
667 *cur = val >> 56; cur += *cur > 0; 681 *cur = val >> 56; cur += val >= ((UV)1 << (8 * 7));
668 *cur = val >> 48; cur += *cur > 0; 682 *cur = val >> 48; cur += val >= ((UV)1 << (8 * 6));
669 *cur = val >> 40; cur += *cur > 0; 683 *cur = val >> 40; cur += val >= ((UV)1 << (8 * 5));
670 *cur = val >> 32; cur += *cur > 0; 684 *cur = val >> 32; cur += val >= ((UV)1 << (8 * 4));
671#endif 685#endif
672 *cur = val >> 24; cur += *cur > 0; 686 *cur = val >> 24; cur += val >= ((UV)1 << (8 * 3));
673 *cur = val >> 16; cur += *cur > 0; 687 *cur = val >> 16; cur += val >= ((UV)1 << (8 * 2));
674 *cur = val >> 8; cur += *cur > 0; 688 *cur = val >> 8; cur += val >= ((UV)1 << (8 * 1));
675 *cur = val ; cur += 1; 689 *cur = val ; cur += 1;
676 690
677 *lenb = 0x80 + cur - lenb - 1; 691 *lenb = 0x80 + cur - lenb - 1;
678 } 692 }
679 693
681} 695}
682 696
683static void 697static void
684put_length (UV val) 698put_length (UV val)
685{ 699{
686 need (5 + val); 700 need (9 + val);
687 cur = put_length_at (val, cur); 701 cur = put_length_at (val, cur);
688} 702}
689 703
690// return how many bytes the encoded length requires 704// return how many bytes the encoded length requires
691static int length_length (UV val) 705static int length_length (UV val)
692{ 706{
693 return val < 0x7fU 707 // use hashing with a DeBruin sequence, anyone?
708 return expect_true (val <= 0x7fU)
694 ? 1 709 ? 1
695 : 2 710 : 2
696 + (val > 0xffU) 711 + (val > 0x000000000000ffU)
697 + (val > 0xffffU) 712 + (val > 0x0000000000ffffU)
698 + (val > 0xffffffU) 713 + (val > 0x00000000ffffffU)
699#if UVSIZE > 4 714#if UVSIZE > 4
700 + (val > 0xffffffffU) 715 + (val > 0x000000ffffffffU)
701 + (val > 0xffffffffffU) 716 + (val > 0x0000ffffffffffU)
702 + (val > 0xffffffffffffU) 717 + (val > 0x00ffffffffffffU)
703 + (val > 0xffffffffffffffU) 718 + (val > 0xffffffffffffffU)
704#endif 719#endif
705 ; 720 ;
706} 721}
707 722
916 // and adjust later 931 // and adjust later
917 need (1); 932 need (1);
918 STRLEN mark = len_fixup_mark (); 933 STRLEN mark = len_fixup_mark ();
919 934
920 if (expect_false (!SvROK (data) || SvTYPE (SvRV (data)) != SVt_PVAV)) 935 if (expect_false (!SvROK (data) || SvTYPE (SvRV (data)) != SVt_PVAV))
921 croak ("BER constructed data must be array-reference"); 936 croak ("BER CONSTRUCTED data must be array-reference");
922 937
923 AV *av = (AV *)SvRV (data); 938 AV *av = (AV *)SvRV (data);
924 int fill = AvFILL (av); 939 int fill = AvFILL (av);
925 940
926 if (expect_false (SvRMAGICAL (av))) 941 if (expect_false (SvRMAGICAL (av)))
927 croak ("BER constructed data must not be tied"); 942 croak ("BER CONSTRUCTED data must not be tied");
928 943
929 int i; 944 int i;
930 for (i = 0; i <= fill; ++i) 945 for (i = 0; i <= fill; ++i)
931 encode_ber (AvARRAY (av)[i]); 946 encode_ber (AvARRAY (av)[i]);
932 947
987 case BER_TYPE_UCS4: 1002 case BER_TYPE_UCS4:
988 encode_ucs (data, 4); 1003 encode_ucs (data, 4);
989 break; 1004 break;
990 1005
991 case BER_TYPE_REAL: 1006 case BER_TYPE_REAL:
1007 croak ("BER_TYPE_REAL not implemented");
1008
992 case BER_TYPE_CROAK: 1009 case BER_TYPE_CROAK:
1010 croak ("class/tag %d/%d mapped to BER_TYPE_CROAK", klass, tag);
1011
993 default: 1012 default:
994 croak ("unconfigured/unsupported class/tag %d/%d", klass, tag); 1013 croak ("unconfigured/unsupported class/tag %d/%d", klass, tag);
995 } 1014 }
996 1015
997} 1016}
1069 const_iv (BER_TYPE_IPADDRESS) 1088 const_iv (BER_TYPE_IPADDRESS)
1070 const_iv (BER_TYPE_CROAK) 1089 const_iv (BER_TYPE_CROAK)
1071 1090
1072 const_iv (SNMP_IPADDRESS) 1091 const_iv (SNMP_IPADDRESS)
1073 const_iv (SNMP_COUNTER32) 1092 const_iv (SNMP_COUNTER32)
1093 const_iv (SNMP_GAUGE32)
1074 const_iv (SNMP_UNSIGNED32) 1094 const_iv (SNMP_UNSIGNED32)
1075 const_iv (SNMP_TIMETICKS) 1095 const_iv (SNMP_TIMETICKS)
1076 const_iv (SNMP_OPAQUE) 1096 const_iv (SNMP_OPAQUE)
1077 const_iv (SNMP_COUNTER64) 1097 const_iv (SNMP_COUNTER64)
1078 }; 1098 };
1079 1099
1080 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) 1100 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--)
1081 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); 1101 newCONSTSUB (stash, (char *)civ[-1].name, newSViv (civ[-1].iv));
1082} 1102}
1083 1103
1084SV * 1104void
1085ber_decode (SV *ber, SV *profile = &PL_sv_undef) 1105ber_decode (SV *ber, SV *profile = &PL_sv_undef)
1106 ALIAS:
1107 ber_decode_prefix = 1
1086 CODE: 1108 PPCODE:
1087{ 1109{
1088 cur_profile = SvPROFILE (profile); 1110 cur_profile = SvPROFILE (profile);
1089 STRLEN len; 1111 STRLEN len;
1090 buf = (U8 *)SvPVbyte (ber, len); 1112 buf = (U8 *)SvPVbyte (ber, len);
1091 cur = buf; 1113 cur = buf;
1092 end = buf + len; 1114 end = buf + len;
1093 1115
1094 RETVAL = decode_ber (); 1116 SV *tuple = decode_ber ();
1117
1118 EXTEND (SP, 2);
1119 PUSHs (sv_2mortal (tuple));
1120
1121 if (ix)
1122 PUSHs (sv_2mortal (newSViv (cur - buf)));
1123 else if (cur != end)
1124 error ("trailing garbage after BER value");
1095} 1125}
1096 OUTPUT: RETVAL
1097 1126
1098void 1127void
1099ber_is (SV *tuple, SV *klass = &PL_sv_undef, SV *tag = &PL_sv_undef, SV *flags = &PL_sv_undef, SV *data = &PL_sv_undef) 1128ber_is (SV *tuple, SV *klass = &PL_sv_undef, SV *tag = &PL_sv_undef, SV *flags = &PL_sv_undef, SV *data = &PL_sv_undef)
1100 PPCODE: 1129 PPCODE:
1101{ 1130{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines