static int add_doubles_metadata(int count,

                                const char *name, const char *sep,

                                TiffContext *s)

{

    char *ap;

    int i;

    double *dp;



    if (count >= INT_MAX / sizeof(int64_t) || count <= 0)

        return AVERROR_INVALIDDATA;

    if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))

        return AVERROR_INVALIDDATA;



    dp = av_malloc(count * sizeof(double));

    if (!dp)

        return AVERROR(ENOMEM);



    for (i = 0; i < count; i++)

        dp[i] = tget_double(&s->gb, s->le);

    ap = doubles2str(dp, count, sep);

    av_freep(&dp);

    if (!ap)

        return AVERROR(ENOMEM);

    av_dict_set(avpriv_frame_get_metadatap(&s->picture), name, ap, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}

static int add_doubles_metadata(int count,

                                const char *name, const char *sep,

                                TiffContext *s)

{

    char *ap;

    int i;

    double *dp;



    if (count >= INT_MAX / sizeof(int64_t) || count <= 0)

        return AVERROR_INVALIDDATA;

    if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))

        return AVERROR_INVALIDDATA;



    dp = av_malloc(count * sizeof(double));

    if (!dp)

        return AVERROR(ENOMEM);



    for (i = 0; i < count; i++)

        dp[i] = tget_double(&s->gb, s->le);

    ap = doubles2str(dp, count, sep);

    av_freep(&dp);

    if (!ap)

        return AVERROR(ENOMEM);

    av_dict_set(avpriv_frame_get_metadatap(&s->picture), name, ap, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}

                                TiffContext *s)     av_dict_set(avpriv_frame_get_metadatap(&s->picture), name, ap, AV_DICT_DONT_STRDUP_VAL);     av_dict_set(avpriv_frame_get_metadatap(&s->picture), name, ap, AV_DICT_DONT_STRDUP_VAL);
static int FUNC_0(int VAR_0,

                                const char *VAR_1, const char *VAR_2,

                                TiffContext *VAR_3)

{

    char *VAR_4;

    int VAR_5;

    double *VAR_6;



    if (VAR_0 >= INT_MAX / sizeof(int64_t) || VAR_0 <= 0)

        return AVERROR_INVALIDDATA;

    if (bytestream2_get_bytes_left(&VAR_3->gb) < VAR_0 * sizeof(int64_t))

        return AVERROR_INVALIDDATA;



    VAR_6 = av_malloc(VAR_0 * sizeof(double));

    if (!VAR_6)

        return AVERROR(ENOMEM);



    for (VAR_5 = 0; VAR_5 < VAR_0; VAR_5++)

        VAR_6[VAR_5] = tget_double(&VAR_3->gb, VAR_3->le);

    VAR_4 = doubles2str(VAR_6, VAR_0, VAR_2);

    av_freep(&VAR_6);

    if (!VAR_4)

        return AVERROR(ENOMEM);

    av_dict_set(avpriv_frame_get_metadatap(&VAR_3->picture), VAR_1, VAR_4, AV_DICT_DONT_STRDUP_VAL);

    return 0;

}

static int FUNC_0(int VAR_0,
const char *VAR_1, const char *VAR_2,
TiffContext *VAR_3)
{ char *VAR_4; int VAR_5; double *VAR_6; if (VAR_0 >= INT_MAX / sizeof(int64_t) || VAR_0 <= 0)
return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&VAR_3->gb) < VAR_0 * sizeof(int64_t))
return AVERROR_INVALIDDATA; VAR_6 = av_malloc(VAR_0 * sizeof(double)); if (!VAR_6)
return AVERROR(ENOMEM); for (VAR_5 = 0; VAR_5 < VAR_0; VAR_5++) VAR_6[VAR_5] = tget_double(&VAR_3->gb, VAR_3->le); VAR_4 = doubles2str(VAR_6, VAR_0, VAR_2); av_freep(&VAR_6); if (!VAR_4)
return AVERROR(ENOMEM); av_dict_set(avpriv_frame_get_metadatap(&VAR_3->picture), VAR_1, VAR_4, AV_DICT_DONT_STRDUP_VAL); return 0; }