static int parse_section_header(GetByteContext *gbc, int *section_size,

                                enum HapSectionType *section_type)

{

    if (bytestream2_get_bytes_left(gbc) < 4)

        return AVERROR_INVALIDDATA;



    *section_size = bytestream2_get_le24(gbc);

    *section_type = bytestream2_get_byte(gbc);



    if (*section_size == 0) {

        if (bytestream2_get_bytes_left(gbc) < 4)

            return AVERROR_INVALIDDATA;



        *section_size = bytestream2_get_le32(gbc);

    }



    if (*section_size > bytestream2_get_bytes_left(gbc))

        return AVERROR_INVALIDDATA;

    else

        return 0;

}

static int parse_section_header(GetByteContext *gbc, int *section_size,

                                enum HapSectionType *section_type)

{

    if (bytestream2_get_bytes_left(gbc) < 4)

        return AVERROR_INVALIDDATA;



    *section_size = bytestream2_get_le24(gbc);

    *section_type = bytestream2_get_byte(gbc);



    if (*section_size == 0) {

        if (bytestream2_get_bytes_left(gbc) < 4)

            return AVERROR_INVALIDDATA;



        *section_size = bytestream2_get_le32(gbc);

    }



    if (*section_size > bytestream2_get_bytes_left(gbc))

        return AVERROR_INVALIDDATA;

    else

        return 0;

}

static int FUNC_0(GetByteContext *VAR_0, int *VAR_1,

                                enum HapSectionType *VAR_2)

{

    if (bytestream2_get_bytes_left(VAR_0) < 4)

        return AVERROR_INVALIDDATA;



    *VAR_1 = bytestream2_get_le24(VAR_0);

    *VAR_2 = bytestream2_get_byte(VAR_0);



    if (*VAR_1 == 0) {

        if (bytestream2_get_bytes_left(VAR_0) < 4)

            return AVERROR_INVALIDDATA;



        *VAR_1 = bytestream2_get_le32(VAR_0);

    }



    if (*VAR_1 > bytestream2_get_bytes_left(VAR_0))

        return AVERROR_INVALIDDATA;

    else

        return 0;

}

static int FUNC_0(GetByteContext *VAR_0, int *VAR_1,
enum HapSectionType *VAR_2)
{ if (bytestream2_get_bytes_left(VAR_0) < 4)
return AVERROR_INVALIDDATA; *VAR_1 = bytestream2_get_le24(VAR_0); *VAR_2 = bytestream2_get_byte(VAR_0); if (*VAR_1 == 0) { if (bytestream2_get_bytes_left(VAR_0) < 4)
return AVERROR_INVALIDDATA; *VAR_1 = bytestream2_get_le32(VAR_0); } if (*VAR_1 > bytestream2_get_bytes_left(VAR_0))
return AVERROR_INVALIDDATA; else
return 0; }