Comment 6 for bug 942595

Revision history for this message
Hobson Lane (hobs) wrote : Re: [Bug 942595] Re: A ValueError is raised when accessing the value of a malformed MakerNote

Sounds good. It makes sense to be conservative with the general release
branch. The more general patch is probably only useful for me. I like to
dump the raw bytes of tags like MakerNote in a semi-human-readable form,
even when they are "undefined."
--Hobson

On Fri, Mar 9, 2012 at 6:40 PM, Olivier Tilloy <email address hidden> wrote:

> Note that the raw_value attribute of the tag (m['Exif.Photo.MakerNote'])
> is an empty string, and this is what causes the ValueError to be raised:
> utils.undefined_to_string(…) expects its parameter to contain the ascii
> codes of a sequence of bytes, separated by white spaces (e.g. "48 50 50
> 49").
>
> It would be relatively easy to patch utils.undefined_to_string(…) to
> check for an empty string and return an empty string in that case.
>
> Hobson, wouldn’t that be enough to fix the bug? As I understand it, your
> patch tries to address a more general problem. I’d rather fix this
> specific one, and then address other issues separately, testing against
> actual images that exhibit the problem and writing unit tests to ensure
> no regressions.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/942595
>
> Title:
> A ValueError is raised when accessing the value of a malformed
> MakerNote
>
> Status in pyexiv2, a python binding to exiv2:
> Confirmed
>
> Bug description:
> There are TODOs in the source code to address this bug and crude
> work-around patch is provided.
>
> If a tag value contains a single Null byte ( chr(0) ), it is
> interpreted by pyexiv2 as an "undefined" value, and attempting to read
> the value for that tag produces the error
>
> ValueError: invalid literal for int() with base 10: ''
>
> when pyexiv2 attempts to convert the string to an integer. This error
> only occured for a Canon EOS image that was processed by the Windows
> photo manager and then had its EXIF tags read and re-written by
> pyexiv2 in Ubuntu. Sample images will be provided in comments to this
> bug.
>
> known to be present in version 0.3.0 (Ubuntu distribution package) and
> version 0.3.2 (development) of pyexiv2
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/pyexiv2/+bug/942595/+subscriptions
>