Skip to content

Copying a tag value using its iterator with Exiv2::invalidByteOrder uses the wrong byte order #3199

Open
@nomis

Description

@nomis

Describe the bug

I'm trying to access Exif.Canon.AFInfo, which is an array of uint16 values, via rexiv2 which uses gexiv2. There is no direct API access to the array of values so I'm using gexiv2_metadata_get_tag_raw() which calls Exiv2::ExifData::iterator.copy(..., Exiv2::invalidByteOrder) on the tag value.

The copy() implementation ends up calling us2Data() with invalidByteOrder which is not handled correctly so it always returns big-endian data, despite the fact that I am reading a little-endian file on a little-endian host.

To Reproduce

Steps to reproduce the behaviour:

  1. Read the Exif.Canon.AFInfo tag from these sample files: BE.txt BE.jpg LE.txt LE.jpg

  2. Copy the bytes from the iterator using Exiv2::invalidByteOrder

  3. Observe that the values are always in big-endian format

Expected behaviour

The API should disallow this type of access or the tag data should be returned in the original byte order.

Desktop:

  • OS and version: Ubuntu 20.04
  • Exiv2 version and source: 0.27.2-8ubuntu2.7

Additional context

There appears to be no API to get the byte order of the Exif data? I'm using Exif.MakerNote.ByteOrder which happens to be a copy of the byte order (which is confusing because the Canon MakerNote footer does contain a byte order too).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions