static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)

{

    uint32_t type, size;

    int64_t pos;

    int ret;



    if (avio_feof(s->pb))

        return AVERROR_EOF;



    pos  = avio_tell(s->pb);

    type = avio_rl32(s->pb);

    size = avio_rb32(s->pb);

    if (size > INT_MAX / s->streams[0]->codecpar->channels)

        return AVERROR_INVALIDDATA;



    size *= s->streams[0]->codecpar->channels;

    if ((ret = avio_skip(s->pb, 24)) < 0) // padding

        return ret;



    if (type == MKTAG('B','L','C','K')) {

        ret = av_get_packet(s->pb, pkt, size);

        pkt->stream_index = 0;

        pkt->pos = pos;

    } else {

        av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type);

        avio_skip(s->pb, size);

        ret = AVERROR_INVALIDDATA;

    }



    return ret;

}

static int ast_read_packet(AVFormatContext *s, AVPacket *pkt)

{

    uint32_t type, size;

    int64_t pos;

    int ret;



    if (avio_feof(s->pb))

        return AVERROR_EOF;



    pos  = avio_tell(s->pb);

    type = avio_rl32(s->pb);

    size = avio_rb32(s->pb);

    if (size > INT_MAX / s->streams[0]->codecpar->channels)

        return AVERROR_INVALIDDATA;



    size *= s->streams[0]->codecpar->channels;

    if ((ret = avio_skip(s->pb, 24)) < 0) 

        return ret;



    if (type == MKTAG('B','L','C','K')) {

        ret = av_get_packet(s->pb, pkt, size);

        pkt->stream_index = 0;

        pkt->pos = pos;

    } else {

        av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type);

        avio_skip(s->pb, size);

        ret = AVERROR_INVALIDDATA;

    }



    return ret;

}

    if (size > INT_MAX / s->streams[0]->codecpar->channels)
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)

{

    uint32_t type, size;

    int64_t pos;

    int VAR_2;



    if (avio_feof(VAR_0->pb))

        return AVERROR_EOF;



    pos  = avio_tell(VAR_0->pb);

    type = avio_rl32(VAR_0->pb);

    size = avio_rb32(VAR_0->pb);

    if (size > INT_MAX / VAR_0->streams[0]->codecpar->channels)

        return AVERROR_INVALIDDATA;



    size *= VAR_0->streams[0]->codecpar->channels;

    if ((VAR_2 = avio_skip(VAR_0->pb, 24)) < 0) 

        return VAR_2;



    if (type == MKTAG('B','L','C','K')) {

        VAR_2 = av_get_packet(VAR_0->pb, VAR_1, size);

        VAR_1->stream_index = 0;

        VAR_1->pos = pos;

    } else {

        av_log(VAR_0, AV_LOG_ERROR, "unknown chunk %x\n", type);

        avio_skip(VAR_0->pb, size);

        VAR_2 = AVERROR_INVALIDDATA;

    }



    return VAR_2;

}

static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)
{ uint32_t type, size; int64_t pos; int VAR_2; if (avio_feof(VAR_0->pb))
return AVERROR_EOF; pos  = avio_tell(VAR_0->pb); type = avio_rl32(VAR_0->pb); size = avio_rb32(VAR_0->pb); if (size > INT_MAX / VAR_0->streams[0]->codecpar->channels)
return AVERROR_INVALIDDATA; size *= VAR_0->streams[0]->codecpar->channels; if ((VAR_2 = avio_skip(VAR_0->pb, 24)) < 0)
return VAR_2; if (type == MKTAG('B','L','C','K')) { VAR_2 = av_get_packet(VAR_0->pb, VAR_1, size); VAR_1->stream_index = 0; VAR_1->pos = pos; } else { av_log(VAR_0, AV_LOG_ERROR, "unknown chunk %x\n", type); avio_skip(VAR_0->pb, size); VAR_2 = AVERROR_INVALIDDATA; } return VAR_2; }