Local build crashes in olympusmn.cpp

Added by Mike Erickson almost 5 years ago

I built a version of the exiv2 0.24 utility using the provided Visual Studio 2012 solution and converting it to a VS 2013 project.
It built successfully.

When I test the utility it runs successfully agains most files, but I get a crash in the C-runtime when reading certain Olympus ORF files.

I have hopefully remembered to attach a copy of the offending file.

The crash dialog says that a "Debug assertion failed." the assertion is in the <vector> header on line 1185.

The crash seems to occur when the utility is trying to print the value of the Exif.OlympusCs.FocusMode tag.

The pre-built executable that I download from the website can successfully parse this file.

In the debugger, the offending line of code is in olympusmn.cpp line 1444. It is hardcoded to pass an index of 1. Line 1441 tests if the count of values is less than 2:

if (value.count() < 2)

But then line 1444 asks for the value at index 1:

v = (uint16_t)value.toLong(1);

which would be the second value, which seems to contradict the test preformed on line 1441.
This appears to me to be the cause of the out-of-range subscript.

If I change line 1441 to:

if (value.count() > 1) {

and line 1454 to :

} else if (value.count()){

then my local build will successfully parse this file.

Why does my local build need this change but the pre-built one runs without it?

Replies (3)

RE: Local build crashes in olympusmn.cpp - Added by Robin Mills almost 5 years ago


Welcome to the Exiv2 Forum. All AlienSkin Engineers are Welcome. Terence gave me a head's up that you'd found a puzzle and would report it.

Thanks for digging into this in some detail. To answer your question "Why do you need a local change when the prebuilt one runs without it?", the answer is that the pre-built exiv2.exe is cross-compiled with GCC and you've built with MSVC. So, although I believe both compilers use dinkumware libraries, they are very different builds. You can see this using the depends32.exe or depends64.exe tools which are in the source bundle (and their source code). The MSVC build shows:

C:\cygwin\home\rmills\gnu\exiv2\trunk\msvc2005\bin\x64\ReleaseDLL>depends64 exiv2.exe
  Not found: MSVCR80.dll
  Not found: MSVCP80.dll
  Not found: MSVCR80.dll
  Not found: MSVCP80.dll

The "prebuilt download":

 Directory of C:\temp
01/12/2013  22:07         3,977,728 exiv2.exe
C:\temp>depends32 exiv2.exe

I think you can also discover those differences dependancies with Microsoft's dumpbin.exe utility.

I think however you've identified something odd in the code about the 2s and 1s. It's 11:47pm here in England and I'm too tired to be bothered investigating this tonight. I'll look tomorrow and review the changes you have suggested. If I concur and the build passes our test suite, I'll open an issue and commit a change to trunk.

RE: Local build crashes in olympusmn.cpp - Added by Robin Mills almost 5 years ago


You are quite right. The code is clearly a little muddled and your fix will work. I've submitted r3289 to the trunk to deal with this. My code isn't identical to your proposal, however it amounts to the same thing.

I've created Issue# 981 to deal with this.

I've marked the bug as "Resolved" and it will be reviewed and marked "Closed" during our release process for v0.25.

Thanks very much for your clear description of the issue, providing a test file and proposing a fix. The cooperation between Team Exiv2 and Alien Skin has got off to a good start. Thanks very much.


RE: Local build crashes in olympusmn.cpp - Added by Mike Erickson almost 5 years ago

Thanks for your help, Robin. Looking forward to working with you.