[FFmpeg-devel] [Read EXIF metadata 1/3] Refactor TIFF tag related functions to share the code.

Michael Niedermayer michaelni at gmx.at
Sat Aug 10 20:51:48 CEST 2013


On Sat, Aug 10, 2013 at 01:27:38PM +0200, Thilo Borgmann wrote:
> 1/3 rev 5
> 
> -Thilo
[...]

> +int ff_tread_tag(AVCodecContext *avctx, GetByteContext *gb, int le,
> +                 unsigned *tag, unsigned *type, unsigned *count, int *next)
> +{
> +    int ifd_tag;
> +    int valid_type;
> +
> +    *tag    = ff_tget_short(gb, le);
> +    *type   = ff_tget_short(gb, le);
> +    *count  = ff_tget_long (gb, le);
> +

> +    ifd_tag    = ff_tis_ifd(*tag);
> +    valid_type = ifd_tag || (*type != 0 && *type < FF_ARRAY_ELEMS(type_sizes));
> +
> +    // check for valid type
> +    if (!valid_type) {
> +        av_log(avctx, AV_LOG_DEBUG, "Unknown tiff tag type (%u) encountered\n",
> +               *type);
> +        return AVERROR_INVALIDDATA;
> +    }

unknown tags shouldnt be invalid
also arent they already handled in the switch/case as "default"
as is they get turned into a return 0 in the calling function and
then likely failure of parsng of subsequent tags

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 2
"100% positive feedback" - "All either got their money back or didnt complain"
"Best seller ever, very honest" - "Seller refunded buyer after failed scam"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130810/ec0ee425/attachment.asc>


More information about the ffmpeg-devel mailing list