static int get_avc_nalsize(H264Context *h, const uint8_t *buf,

                           int buf_size, int *buf_index)

{

    int i, nalsize = 0;



    if (*buf_index >= buf_size - h->nal_length_size)

        return -1;



    for (i = 0; i < h->nal_length_size; i++)

        nalsize = (nalsize << 8) | buf[(*buf_index)++];

    if (nalsize <= 0 || nalsize > buf_size - *buf_index) {

        av_log(h->avctx, AV_LOG_ERROR,

               "AVC: nal size %d\n", nalsize);

        return -1;

    }

    return nalsize;

}

static int get_avc_nalsize(H264Context *h, const uint8_t *buf,

                           int buf_size, int *buf_index)

{

    int i, nalsize = 0;



    if (*buf_index >= buf_size - h->nal_length_size)

        return -1;



    for (i = 0; i < h->nal_length_size; i++)

        nalsize = (nalsize << 8) | buf[(*buf_index)++];

    if (nalsize <= 0 || nalsize > buf_size - *buf_index) {

        av_log(h->avctx, AV_LOG_ERROR,

               "AVC: nal size %d\n", nalsize);

        return -1;

    }

    return nalsize;

}

        nalsize = (nalsize << 8) | buf[(*buf_index)++];
static int FUNC_0(H264Context *VAR_0, const uint8_t *VAR_1,

                           int VAR_2, int *VAR_3)

{

    int VAR_4, VAR_5 = 0;



    if (*VAR_3 >= VAR_2 - VAR_0->nal_length_size)

        return -1;



    for (VAR_4 = 0; VAR_4 < VAR_0->nal_length_size; VAR_4++)

        VAR_5 = (VAR_5 << 8) | VAR_1[(*VAR_3)++];

    if (VAR_5 <= 0 || VAR_5 > VAR_2 - *VAR_3) {

        av_log(VAR_0->avctx, AV_LOG_ERROR,

               "AVC: nal size %d\n", VAR_5);

        return -1;

    }

    return VAR_5;

}

static int FUNC_0(H264Context *VAR_0, const uint8_t *VAR_1,
int VAR_2, int *VAR_3)
{ int VAR_4, VAR_5 = 0; if (*VAR_3 >= VAR_2 - VAR_0->nal_length_size)
return -1; for (VAR_4 = 0; VAR_4 < VAR_0->nal_length_size; VAR_4++) VAR_5 = (VAR_5 << 8) | VAR_1[(*VAR_3)++]; if (VAR_5 <= 0 || VAR_5 > VAR_2 - *VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR,
"AVC: nal size %d\n", VAR_5); return -1; } return VAR_5; }