… | |
… | |
780 | |
780 | |
781 | for (;;) |
781 | for (;;) |
782 | { |
782 | { |
783 | WANT (1); |
783 | WANT (1); |
784 | |
784 | |
785 | if (*dec->cur == (MAJOR_MISC | MINOR_INDEF)) |
785 | if (*dec->cur == (MAJOR_MISC | MINOR_INDEF) || dec->err) |
786 | { |
786 | { |
787 | ++dec->cur; |
787 | ++dec->cur; |
788 | break; |
788 | break; |
789 | } |
789 | } |
790 | |
790 | |
… | |
… | |
898 | |
898 | |
899 | for (;;) |
899 | for (;;) |
900 | { |
900 | { |
901 | WANT (1); |
901 | WANT (1); |
902 | |
902 | |
903 | if (*dec->cur == (MAJOR_MISC | MINOR_INDEF)) |
903 | if (*dec->cur == (MAJOR_MISC | MINOR_INDEF) || dec->err) |
904 | { |
904 | { |
905 | ++dec->cur; |
905 | ++dec->cur; |
906 | break; |
906 | break; |
907 | } |
907 | } |
908 | |
908 | |
… | |
… | |
1029 | if ((*dec->cur >> MAJOR_SHIFT) != (MAJOR_POS_INT >> MAJOR_SHIFT)) |
1029 | if ((*dec->cur >> MAJOR_SHIFT) != (MAJOR_POS_INT >> MAJOR_SHIFT)) |
1030 | ERR ("corrupted CBOR data (stringref index not an unsigned integer)"); |
1030 | ERR ("corrupted CBOR data (stringref index not an unsigned integer)"); |
1031 | |
1031 | |
1032 | UV idx = decode_uint (dec); |
1032 | UV idx = decode_uint (dec); |
1033 | |
1033 | |
1034 | if (!dec->stringref || (int)idx > AvFILLp (dec->stringref)) |
1034 | if (!dec->stringref || idx >= (UV)(1 + AvFILLp (dec->stringref))) |
1035 | ERR ("corrupted CBOR data (stringref index out of bounds or outside namespace)"); |
1035 | ERR ("corrupted CBOR data (stringref index out of bounds or outside namespace)"); |
1036 | |
1036 | |
1037 | sv = newSVsv (AvARRAY (dec->stringref)[idx]); |
1037 | sv = newSVsv (AvARRAY (dec->stringref)[idx]); |
1038 | } |
1038 | } |
1039 | break; |
1039 | break; |
… | |
… | |
1067 | if ((*dec->cur >> MAJOR_SHIFT) != (MAJOR_POS_INT >> MAJOR_SHIFT)) |
1067 | if ((*dec->cur >> MAJOR_SHIFT) != (MAJOR_POS_INT >> MAJOR_SHIFT)) |
1068 | ERR ("corrupted CBOR data (sharedref index not an unsigned integer)"); |
1068 | ERR ("corrupted CBOR data (sharedref index not an unsigned integer)"); |
1069 | |
1069 | |
1070 | UV idx = decode_uint (dec); |
1070 | UV idx = decode_uint (dec); |
1071 | |
1071 | |
1072 | if (!dec->shareable || (int)idx > AvFILLp (dec->shareable)) |
1072 | if (!dec->shareable || idx >= (UV)(1 + AvFILLp (dec->shareable))) |
1073 | ERR ("corrupted CBOR data (sharedref index out of bounds)"); |
1073 | ERR ("corrupted CBOR data (sharedref index out of bounds)"); |
1074 | |
1074 | |
1075 | sv = SvREFCNT_inc_NN (AvARRAY (dec->shareable)[idx]); |
1075 | sv = SvREFCNT_inc_NN (AvARRAY (dec->shareable)[idx]); |
1076 | |
1076 | |
1077 | if (sv == &PL_sv_undef) |
1077 | if (sv == &PL_sv_undef) |
… | |
… | |
1668 | cbor_init (&cbor); |
1668 | cbor_init (&cbor); |
1669 | PUTBACK; cborstr = decode_cbor (cborstr, &cbor, 0); SPAGAIN; |
1669 | PUTBACK; cborstr = decode_cbor (cborstr, &cbor, 0); SPAGAIN; |
1670 | XPUSHs (cborstr); |
1670 | XPUSHs (cborstr); |
1671 | } |
1671 | } |
1672 | |
1672 | |
|
|
1673 | #ifdef __AFL_COMPILER |
|
|
1674 | |
|
|
1675 | void |
|
|
1676 | afl_init () |
|
|
1677 | CODE: |
|
|
1678 | __AFL_INIT (); |
|
|
1679 | |
|
|
1680 | int |
|
|
1681 | afl_loop (unsigned int count = 10000) |
|
|
1682 | CODE: |
|
|
1683 | RETVAL = __AFL_LOOP (count); |
|
|
1684 | OUTPUT: |
|
|
1685 | RETVAL |
|
|
1686 | |
|
|
1687 | #endif |
|
|
1688 | |