libavcodec/h264_parser.c:271: error: Buffer Overrun L3
  Offset: [2, +oo] Size: [1, 2147483631] by call to `ff_h264_sei_decode`.

libavcodec/h264_parser.c:221:5: Call
219.     s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;
220. 
221.     ff_h264_sei_uninit(&p->sei);
         ^
222. 
223.     if (!buf_size)

libavcodec/h264_sei.c:52:5: Assignment
  50.     h->afd.present                 =  0;
  51. 
  52.     h->a53_caption.a53_caption_size = 0;
          ^
  53.     av_freep(&h->a53_caption.a53_caption);
  54. }

libavcodec/h264_parser.c:271:13: Call
269.             break;
270.         case NAL_SEI:
271.             ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx);
                 ^
272.             break;
273.         case NAL_IDR_SLICE:

libavcodec/h264_sei.c:346:1: Parameter `h->a53_caption.a53_caption_size`
  344. }
  345. 
  346. int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
       ^
  347.                        const H264ParamSets *ps, void *logctx)
  348. {

libavcodec/h264_sei.c:379:19: Call
  377.             break;
  378.         case SEI_TYPE_USER_DATA_REGISTERED:
  379.             ret = decode_registered_user_data(h, gb, logctx, size);
                         ^
  380.             break;
  381.         case SEI_TYPE_USER_DATA_UNREGISTERED:

libavcodec/h264_sei.c:191:1: Parameter `h->a53_caption.a53_caption_size`
    189. }
    190. 
    191. static int decode_registered_user_data(H264SEIContext *h, GetBitContext *gb,
         ^
    192.                                        void *logctx, int size)
    193. {

libavcodec/h264_sei.c:216:20: Call
    214.             return decode_registered_user_data_afd(&h->afd, gb, size);
    215.         case MKBETAG('G', 'A', '9', '4'):       // closed captions
    216.             return decode_registered_user_data_closed_caption(&h->a53_caption, gb,
                            ^
    217.                                                               logctx, size);
    218.         default:

libavcodec/h264_sei.c:136:1: <Offset trace>
134. }
135. 
136. static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
     ^
137.                                                      GetBitContext *gb, void *logctx,
138.                                                      int size)

libavcodec/h264_sei.c:136:1: Parameter `h->a53_caption_size`
      134. }
      135. 
      136. static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
           ^
      137.                                                      GetBitContext *gb, void *logctx,
      138.                                                      int size)

libavcodec/h264_sei.c:172:36: Assignment
      170. 
      171.                 for (i = 0; i < cc_count; i++) {
      172.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
                                              ^
      173.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
      174.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);

libavcodec/h264_sei.c:173:36: Assignment
      171.                 for (i = 0; i < cc_count; i++) {
      172.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
      173.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
                                              ^
      174.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
      175.                 }

libavcodec/h264_sei.c:154:24: <Length trace>
152.         if (flag) {
153.             skip_bits(gb, 1);       // zero bit
154.             cc_count = get_bits(gb, 5);
                            ^
155.             skip_bits(gb, 8);       // reserved
156.             size -= 2;

libavcodec/h264_sei.c:154:24: Call
      152.         if (flag) {
      153.             skip_bits(gb, 1);       // zero bit
      154.             cc_count = get_bits(gb, 5);
                                  ^
      155.             skip_bits(gb, 8);       // reserved
      156.             size -= 2;

libavcodec/get_bits.h:245:5: Call
        243.     register int tmp;
        244.     OPEN_READER(re, s);
        245.     UPDATE_CACHE(re, s);
                 ^
        246.     tmp = SHOW_UBITS(re, s, n);
        247.     LAST_SKIP_BITS(re, s, n);

libavutil/ppc/intreadwrite.h:63:5: Assignment
          61.     uint32_t v;
          62.     __asm__ ("lwbrx   %0, %y1" : "=r"(v) : "Z"(*(const uint32_t*)p));
          63.     return v;
                  ^
          64. }
          65. 

libavcodec/get_bits.h:245:5: Assignment
        243.     register int tmp;
        244.     OPEN_READER(re, s);
        245.     UPDATE_CACHE(re, s);
                 ^
        246.     tmp = SHOW_UBITS(re, s, n);
        247.     LAST_SKIP_BITS(re, s, n);

libavcodec/get_bits.h:246:5: Assignment
        244.     OPEN_READER(re, s);
        245.     UPDATE_CACHE(re, s);
        246.     tmp = SHOW_UBITS(re, s, n);
                 ^
        247.     LAST_SKIP_BITS(re, s, n);
        248.     CLOSE_READER(re, s);

libavcodec/get_bits.h:249:5: Assignment
        247.     LAST_SKIP_BITS(re, s, n);
        248.     CLOSE_READER(re, s);
        249.     return tmp;
                 ^
        250. }
        251. 

libavcodec/h264_sei.c:154:13: Assignment
      152.         if (flag) {
      153.             skip_bits(gb, 1);       // zero bit
      154.             cc_count = get_bits(gb, 5);
                       ^
      155.             skip_bits(gb, 8);       // reserved
      156.             size -= 2;

libavcodec/h264_sei.c:159:17: Assignment
      157. 
      158.             if (cc_count && size >= cc_count * 3) {
      159.                 const uint64_t new_size = (h->a53_caption_size + cc_count
                           ^
      160.                                            * UINT64_C(3));
      161.                 int i, ret;

libavcodec/h264_sei.c:167:23: Call
      165. 
      166.                 /* Allow merging of the cc data from two fields. */
      167.                 ret = av_reallocp(&h->a53_caption, new_size);
                                 ^
      168.                 if (ret < 0)
      169.                     return ret;

libavutil/mem.c:145:9: Call
        143. 
        144.     if (!size) {
        145.         av_freep(ptr);
                     ^
        146.         return 0;
        147.     }

libavutil/mem.c:207:26: Assignment
          205. 
          206.     memcpy(&val, arg, sizeof(val));
          207.     memcpy(arg, &(void *){ NULL }, sizeof(val));
                                        ^
          208.     av_free(val);
          209. }

libavcodec/h264_sei.c:174:21: Array access: Offset: [2, +oo] Size: [1, 2147483631] by call to `ff_h264_sei_decode` 
      172.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
      173.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
      174.                     h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
                               ^
      175.                 }
      176. 

static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,
                                                     GetBitContext *gb, void *logctx,
                                                     int size)
{
    int flag;
    int user_data_type_code;
    int cc_count;
    if (size < 3)
        return AVERROR(EINVAL);
    user_data_type_code = get_bits(gb, 8);
    if (user_data_type_code == 0x3) {
        skip_bits(gb, 1);
        flag = get_bits(gb, 1);
        if (flag) {
            skip_bits(gb, 1);
            cc_count = get_bits(gb, 5);
            skip_bits(gb, 8);
            size -= 2;
            if (cc_count && size >= cc_count * 3) {
                const uint64_t new_size = (h->a53_caption_size + cc_count
                                           * UINT64_C(3));
                int i, ret;
                if (new_size > INT_MAX)
                    return AVERROR(EINVAL);
                ret = av_reallocp(&h->a53_caption, new_size);
                if (ret < 0)
                    return ret;
                for (i = 0; i < cc_count; i++) {
                    h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
                    h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
                    h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);
                }
                skip_bits(gb, 8);
            }
        }
    } else {
        int i;
        avpriv_request_sample(logctx, "Subtitles with data type 0x%02x",
                              user_data_type_code);
        for (i = 0; i < size - 1; i++)
            skip_bits(gb, 8);
    }
    return 0;
}
['static inline int parse_nal_units(AVCodecParserContext *s,\n                                  AVCodecContext *avctx,\n                                  const uint8_t *buf, int buf_size)\n{\n    H264ParseContext *p = s->priv_data;\n    const uint8_t *buf_end = buf + buf_size;\n    H2645NAL nal = { NULL };\n    unsigned int pps_id;\n    unsigned int slice_type;\n    int state = -1, got_reset = 0;\n    int field_poc[2];\n    int ret;\n    s->pict_type         = AV_PICTURE_TYPE_I;\n    s->key_frame         = 0;\n    s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN;\n    ff_h264_sei_uninit(&p->sei);\n    if (!buf_size)\n        return 0;\n    for (;;) {\n        const SPS *sps;\n        int src_length, consumed;\n        buf = avpriv_find_start_code(buf, buf_end, &state);\n        if (buf >= buf_end)\n            break;\n        --buf;\n        src_length = buf_end - buf;\n        switch (state & 0x1f) {\n        case NAL_SLICE:\n        case NAL_IDR_SLICE:\n            if ((state & 0x1f) == NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) {\n                if (src_length > 60)\n                    src_length = 60;\n            } else {\n                if (src_length > 1000)\n                    src_length = 1000;\n            }\n            break;\n        }\n        consumed = ff_h2645_extract_rbsp(buf, src_length, &nal);\n        if (consumed < 0)\n            break;\n        ret = init_get_bits(&nal.gb, nal.data, nal.size * 8);\n        if (ret < 0)\n            goto fail;\n        get_bits1(&nal.gb);\n        nal.ref_idc = get_bits(&nal.gb, 2);\n        nal.type    = get_bits(&nal.gb, 5);\n        switch (nal.type) {\n        case NAL_SPS:\n            ff_h264_decode_seq_parameter_set(&nal.gb, avctx, &p->ps);\n            break;\n        case NAL_PPS:\n            ff_h264_decode_picture_parameter_set(&nal.gb, avctx, &p->ps,\n                                                 nal.size_bits);\n            break;\n        case NAL_SEI:\n            ff_h264_sei_decode(&p->sei, &nal.gb, &p->ps, avctx);\n            break;\n        case NAL_IDR_SLICE:\n            s->key_frame = 1;\n            p->poc.prev_frame_num        = 0;\n            p->poc.prev_frame_num_offset = 0;\n            p->poc.prev_poc_msb          =\n            p->poc.prev_poc_lsb          = 0;\n        case NAL_SLICE:\n            get_ue_golomb(&nal.gb);\n            slice_type   = get_ue_golomb_31(&nal.gb);\n            s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5];\n            if (p->sei.recovery_point.recovery_frame_cnt >= 0) {\n                s->key_frame = 1;\n            }\n            pps_id = get_ue_golomb(&nal.gb);\n            if (pps_id >= MAX_PPS_COUNT) {\n                av_log(avctx, AV_LOG_ERROR,\n                       "pps_id %u out of range\\n", pps_id);\n                goto fail;\n            }\n            if (!p->ps.pps_list[pps_id]) {\n                av_log(avctx, AV_LOG_ERROR,\n                       "non-existing PPS %u referenced\\n", pps_id);\n                goto fail;\n            }\n            p->ps.pps = (const PPS*)p->ps.pps_list[pps_id]->data;\n            if (!p->ps.sps_list[p->ps.pps->sps_id]) {\n                av_log(avctx, AV_LOG_ERROR,\n                       "non-existing SPS %u referenced\\n", p->ps.pps->sps_id);\n                goto fail;\n            }\n            p->ps.sps = (SPS*)p->ps.sps_list[p->ps.pps->sps_id]->data;\n            sps = p->ps.sps;\n            p->poc.frame_num = get_bits(&nal.gb, sps->log2_max_frame_num);\n            s->coded_width  = 16 * sps->mb_width;\n            s->coded_height = 16 * sps->mb_height;\n            s->width        = s->coded_width  - (sps->crop_right + sps->crop_left);\n            s->height       = s->coded_height - (sps->crop_top   + sps->crop_bottom);\n            if (s->width <= 0 || s->height <= 0) {\n                s->width  = s->coded_width;\n                s->height = s->coded_height;\n            }\n            switch (sps->bit_depth_luma) {\n            case 9:\n                if (sps->chroma_format_idc == 3)      s->format = AV_PIX_FMT_YUV444P9;\n                else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P9;\n                else                                  s->format = AV_PIX_FMT_YUV420P9;\n                break;\n            case 10:\n                if (sps->chroma_format_idc == 3)      s->format = AV_PIX_FMT_YUV444P10;\n                else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P10;\n                else                                  s->format = AV_PIX_FMT_YUV420P10;\n                break;\n            case 8:\n                if (sps->chroma_format_idc == 3)      s->format = AV_PIX_FMT_YUV444P;\n                else if (sps->chroma_format_idc == 2) s->format = AV_PIX_FMT_YUV422P;\n                else                                  s->format = AV_PIX_FMT_YUV420P;\n                break;\n            default:\n                s->format = AV_PIX_FMT_NONE;\n            }\n            avctx->profile = ff_h264_get_profile(sps);\n            avctx->level   = sps->level_idc;\n            if (sps->frame_mbs_only_flag) {\n                p->picture_structure = PICT_FRAME;\n            } else {\n                if (get_bits1(&nal.gb)) {\n                    p->picture_structure = PICT_TOP_FIELD + get_bits1(&nal.gb);\n                } else {\n                    p->picture_structure = PICT_FRAME;\n                }\n            }\n            if (nal.type == NAL_IDR_SLICE)\n                get_ue_golomb(&nal.gb);\n            if (sps->poc_type == 0) {\n                p->poc.poc_lsb = get_bits(&nal.gb, sps->log2_max_poc_lsb);\n                if (p->ps.pps->pic_order_present == 1 &&\n                    p->picture_structure == PICT_FRAME)\n                    p->poc.delta_poc_bottom = get_se_golomb(&nal.gb);\n            }\n            if (sps->poc_type == 1 &&\n                !sps->delta_pic_order_always_zero_flag) {\n                p->poc.delta_poc[0] = get_se_golomb(&nal.gb);\n                if (p->ps.pps->pic_order_present == 1 &&\n                    p->picture_structure == PICT_FRAME)\n                    p->poc.delta_poc[1] = get_se_golomb(&nal.gb);\n            }\n            field_poc[0] = field_poc[1] = INT_MAX;\n            ff_h264_init_poc(field_poc, &s->output_picture_number, sps,\n                             &p->poc, p->picture_structure, nal.ref_idc);\n            if (nal.ref_idc && nal.type != NAL_IDR_SLICE) {\n                got_reset = scan_mmco_reset(s, &nal.gb, avctx);\n                if (got_reset < 0)\n                    goto fail;\n            }\n            p->poc.prev_frame_num        = got_reset ? 0 : p->poc.frame_num;\n            p->poc.prev_frame_num_offset = got_reset ? 0 : p->poc.frame_num_offset;\n            if (nal.ref_idc != 0) {\n                if (!got_reset) {\n                    p->poc.prev_poc_msb = p->poc.poc_msb;\n                    p->poc.prev_poc_lsb = p->poc.poc_lsb;\n                } else {\n                    p->poc.prev_poc_msb = 0;\n                    p->poc.prev_poc_lsb =\n                        p->picture_structure == PICT_BOTTOM_FIELD ? 0 : field_poc[0];\n                }\n            }\n            if (sps->pic_struct_present_flag) {\n                switch (p->sei.picture_timing.pic_struct) {\n                case SEI_PIC_STRUCT_TOP_FIELD:\n                case SEI_PIC_STRUCT_BOTTOM_FIELD:\n                    s->repeat_pict = 0;\n                    break;\n                case SEI_PIC_STRUCT_FRAME:\n                case SEI_PIC_STRUCT_TOP_BOTTOM:\n                case SEI_PIC_STRUCT_BOTTOM_TOP:\n                    s->repeat_pict = 1;\n                    break;\n                case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:\n                case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:\n                    s->repeat_pict = 2;\n                    break;\n                case SEI_PIC_STRUCT_FRAME_DOUBLING:\n                    s->repeat_pict = 3;\n                    break;\n                case SEI_PIC_STRUCT_FRAME_TRIPLING:\n                    s->repeat_pict = 5;\n                    break;\n                default:\n                    s->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0;\n                    break;\n                }\n            } else {\n                s->repeat_pict = p->picture_structure == PICT_FRAME ? 1 : 0;\n            }\n            if (p->picture_structure == PICT_FRAME) {\n                s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;\n                if (sps->pic_struct_present_flag) {\n                    switch (p->sei.picture_timing.pic_struct) {\n                    case SEI_PIC_STRUCT_TOP_BOTTOM:\n                    case SEI_PIC_STRUCT_TOP_BOTTOM_TOP:\n                        s->field_order = AV_FIELD_TT;\n                        break;\n                    case SEI_PIC_STRUCT_BOTTOM_TOP:\n                    case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM:\n                        s->field_order = AV_FIELD_BB;\n                        break;\n                    default:\n                        s->field_order = AV_FIELD_PROGRESSIVE;\n                        break;\n                    }\n                } else {\n                    if (field_poc[0] < field_poc[1])\n                        s->field_order = AV_FIELD_TT;\n                    else if (field_poc[0] > field_poc[1])\n                        s->field_order = AV_FIELD_BB;\n                    else\n                        s->field_order = AV_FIELD_PROGRESSIVE;\n                }\n            } else {\n                if (p->picture_structure == PICT_TOP_FIELD)\n                    s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD;\n                else\n                    s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD;\n                s->field_order = AV_FIELD_UNKNOWN;\n            }\n            av_freep(&nal.rbsp_buffer);\n            return 0;\n        }\n        buf += consumed;\n    }\n    av_log(avctx, AV_LOG_ERROR, "missing picture in access unit\\n");\nfail:\n    av_freep(&nal.rbsp_buffer);\n    return -1;\n}', 'void ff_h264_sei_uninit(H264SEIContext *h)\n{\n    h->unregistered.x264_build           = -1;\n    h->recovery_point.recovery_frame_cnt = -1;\n    h->picture_timing.dpb_output_delay  = 0;\n    h->picture_timing.cpb_removal_delay = -1;\n    h->buffering_period.present    = 0;\n    h->frame_packing.present       = 0;\n    h->display_orientation.present = 0;\n    h->afd.present                 =  0;\n    h->a53_caption.a53_caption_size = 0;\n    av_freep(&h->a53_caption.a53_caption);\n}', 'int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,\n                       const H264ParamSets *ps, void *logctx)\n{\n    while (get_bits_left(gb) > 16) {\n        int size = 0;\n        int type = 0;\n        int ret  = 0;\n        int last = 0;\n        while (get_bits_left(gb) >= 8 &&\n               (last = get_bits(gb, 8)) == 255) {\n            type += 255;\n        }\n        type += last;\n        last = 0;\n        while (get_bits_left(gb) >= 8 &&\n               (last = get_bits(gb, 8)) == 255) {\n            size += 255;\n        }\n        size += last;\n        if (size > get_bits_left(gb) / 8) {\n            av_log(logctx, AV_LOG_ERROR, "SEI type %d truncated at %d\\n",\n                   type, get_bits_left(gb));\n            return AVERROR_INVALIDDATA;\n        }\n        switch (type) {\n        case SEI_TYPE_PIC_TIMING:\n            ret = decode_picture_timing(&h->picture_timing, gb, ps->sps, logctx);\n            break;\n        case SEI_TYPE_USER_DATA_REGISTERED:\n            ret = decode_registered_user_data(h, gb, logctx, size);\n            break;\n        case SEI_TYPE_USER_DATA_UNREGISTERED:\n            ret = decode_unregistered_user_data(&h->unregistered, gb, logctx, size);\n            break;\n        case SEI_TYPE_RECOVERY_POINT:\n            ret = decode_recovery_point(&h->recovery_point, gb);\n            break;\n        case SEI_TYPE_BUFFERING_PERIOD:\n            ret = decode_buffering_period(&h->buffering_period, gb, ps, logctx);\n            break;\n        case SEI_TYPE_FRAME_PACKING:\n            ret = decode_frame_packing_arrangement(&h->frame_packing, gb);\n            break;\n        case SEI_TYPE_DISPLAY_ORIENTATION:\n            ret = decode_display_orientation(&h->display_orientation, gb);\n            break;\n        default:\n            av_log(logctx, AV_LOG_DEBUG, "unknown SEI type %d\\n", type);\n            skip_bits(gb, 8 * size);\n        }\n        if (ret < 0)\n            return ret;\n        align_get_bits(gb);\n    }\n    return 0;\n}', "static int decode_registered_user_data(H264SEIContext *h, GetBitContext *gb,\n                                       void *logctx, int size)\n{\n    uint32_t country_code;\n    uint32_t user_identifier;\n    if (size < 7)\n        return AVERROR_INVALIDDATA;\n    size -= 7;\n    country_code = get_bits(gb, 8);\n    if (country_code == 0xFF) {\n        skip_bits(gb, 8);\n        size--;\n    }\n    skip_bits(gb, 8);\n    skip_bits(gb, 8);\n    user_identifier = get_bits_long(gb, 32);\n    switch (user_identifier) {\n        case MKBETAG('D', 'T', 'G', '1'):\n            return decode_registered_user_data_afd(&h->afd, gb, size);\n        case MKBETAG('G', 'A', '9', '4'):\n            return decode_registered_user_data_closed_caption(&h->a53_caption, gb,\n                                                              logctx, size);\n        default:\n            skip_bits(gb, size * 8);\n            break;\n    }\n    return 0;\n}", 'static int decode_registered_user_data_closed_caption(H264SEIA53Caption *h,\n                                                     GetBitContext *gb, void *logctx,\n                                                     int size)\n{\n    int flag;\n    int user_data_type_code;\n    int cc_count;\n    if (size < 3)\n        return AVERROR(EINVAL);\n    user_data_type_code = get_bits(gb, 8);\n    if (user_data_type_code == 0x3) {\n        skip_bits(gb, 1);\n        flag = get_bits(gb, 1);\n        if (flag) {\n            skip_bits(gb, 1);\n            cc_count = get_bits(gb, 5);\n            skip_bits(gb, 8);\n            size -= 2;\n            if (cc_count && size >= cc_count * 3) {\n                const uint64_t new_size = (h->a53_caption_size + cc_count\n                                           * UINT64_C(3));\n                int i, ret;\n                if (new_size > INT_MAX)\n                    return AVERROR(EINVAL);\n                ret = av_reallocp(&h->a53_caption, new_size);\n                if (ret < 0)\n                    return ret;\n                for (i = 0; i < cc_count; i++) {\n                    h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);\n                    h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);\n                    h->a53_caption[h->a53_caption_size++] = get_bits(gb, 8);\n                }\n                skip_bits(gb, 8);\n            }\n        }\n    } else {\n        int i;\n        avpriv_request_sample(logctx, "Subtitles with data type 0x%02x",\n                              user_data_type_code);\n        for (i = 0; i < size - 1; i++)\n            skip_bits(gb, 8);\n    }\n    return 0;\n}', 'static inline unsigned int get_bits(GetBitContext *s, int n)\n{\n    register int tmp;\n    OPEN_READER(re, s);\n    UPDATE_CACHE(re, s);\n    tmp = SHOW_UBITS(re, s, n);\n    LAST_SKIP_BITS(re, s, n);\n    CLOSE_READER(re, s);\n    return tmp;\n}', 'int av_reallocp(void *ptr, size_t size)\n{\n    void *val;\n    if (!size) {\n        av_freep(ptr);\n        return 0;\n    }\n    memcpy(&val, ptr, sizeof(val));\n    val = av_realloc(val, size);\n    if (!val) {\n        av_freep(ptr);\n        return AVERROR(ENOMEM);\n    }\n    memcpy(ptr, &val, sizeof(val));\n    return 0;\n}', 'void av_freep(void *arg)\n{\n    void *val;\n    memcpy(&val, arg, sizeof(val));\n    memcpy(arg, &(void *){ NULL }, sizeof(val));\n    av_free(val);\n}']