ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEN 3.1.2 Loading pictures from a fujifilm cam
 New Topic  Reply to Topic
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

jcrochet

9 Posts

Posted - Jun 21 2011 :  01:41:57  Show Profile  Reply
Hello everybody,

I have a "big" problem with ImageEN 3.1.2 in my application.

I can't load or preview some pictures comming from a fuji camera and I got an access violation.
With ImageEN 3.0.5 there is no problem.

I figured out that the problem come from hyieutils.pas unit in the function "TIETagsHandler.ReadFromStream". The headerType of the tags is iemnIFDOFFSET.

I saw an update in 3.1.0 in procedure TIETagsHandler.CheckHeader about fujifilm maker. If a remove the item
(signature:'FUJIFILM';         base:iemnTIFFHeader; headerType:iemnIFDOFFSET; byteOrder:ieboLittleEndian)

the problem disappear.

Do you have any ideas about this error ?

Edit:
I tried to load the pictures with the demo "Photo Editor" in Download section of the site and I had the same problem. There is no preview of the picture in the OpenFile Dialog and have an access violation

Regards,

fab

1310 Posts

Posted - Jun 21 2011 :  02:34:46  Show Profile  Reply
Dear jcrochet,
please could you post a link or send a sample image for tests?
Go to Top of Page

jcrochet

9 Posts

Posted - Jun 21 2011 :  03:03:28  Show Profile  Reply
Hello,

Here is a link to the JPG file:
http://update.sidexa.fr/PO/PVSE/P0003.JPG
Go to Top of Page

fab

1310 Posts

Posted - Jun 21 2011 :  03:47:10  Show Profile  Reply
Thank you for the image.
The fix is at hyieutils.pas, in TIETagsHandler.ReadFromStream, instead of...

if (dpos<0) or (dpos+z>=size) then


...write...

if (dpos<0) or (int64(dpos)+z>=size) then


Of course the fix will be included in next version.
Go to Top of Page

jcrochet

9 Posts

Posted - Jun 21 2011 :  04:53:31  Show Profile  Reply
Thank you for your help !

Now I can load and open the image. but unfortunately I have a new error.
To chosse the image on hard disk I use a TOpenImageEnDialog object.
And when I call the destructor "FOpenDialog.Free" I got an EInvalidPointer exception ("opération de pointeur invalide" in french)

In debug mode I found that the error is in "TOpenImageEnDialog.Destroy" when the "FreeAndNil(FImageEnView);" is called.
Then I figured out that the exception is thrown in "TIETagsHandler.Clear" procedure in hyieutils.pas unit when the instruction "freemem(fTIFFEnv.IFD);" is called.

Thank you for your help.
Go to Top of Page

fab

1310 Posts

Posted - Jun 21 2011 :  06:37:25  Show Profile  Reply
Unfortunately I cannot replicate. Is the same jpeg (P0003.JPG)?
Go to Top of Page

jcrochet

9 Posts

Posted - Jun 22 2011 :  00:50:52  Show Profile  Reply
Excuse me it was an error in my own source code.

Everything is working well
Thank you Fabrizio
Go to Top of Page

jcrochet

9 Posts

Posted - Jul 04 2011 :  06:28:46  Show Profile  Reply
Hi everybody

I came back with my problem of loading picture from FUJIFILM camera.

A customer call me because he got some Access Violation in my App when loading some pictures.

I put a little delphi 2007 project here so you can test it.
http://update.sidexa.fr/PO/ImageEN/Project.zip
The Access Violation accurs about once every 10 times.

Thank you for your help.
Go to Top of Page

jcrochet

9 Posts

Posted - Jul 04 2011 :  06:31:13  Show Profile  Reply
Update :
The error come from
tagscount := IECSwapWord(pword(@buffer[bufferPos])^, not littleEndian);

in hyieutils.pas TIETagsHandler.ReadFromStream procedure.

Regards,
Go to Top of Page

fab

1310 Posts

Posted - Jul 04 2011 :  13:27:40  Show Profile  Reply
Hi,
thank you for the test project and file (...I hope you don't use TImageEnIO alone in your projects...).

To fix this problem please open hyieutils.pas and go to TIETagsHandler.ReadFromStream method. Add the marked code:


....
      iemnIFDOFFSET:
        begin
          // read IFD offset and move
          CopyMemory(@dw, @buffer[bufferPos], sizeof(dword));
          inc(bufferPos, dw-8);
        end;
    end;

    if bufferPos >= size then     // <<<< ADD THIS
      exit;                       // <<<< ADD THIS

    case fEXIFMakerInfo.byteOrder of
      ieboFromTIFFHeader: littleEndian := fEXIFMakerInfo.TIFFHeader.Id = $4949;
      ieboLittleEndian:   littleEndian := true;
      ieboBigEndian:      littleEndian := false;
    end;
....
Go to Top of Page

jcrochet

9 Posts

Posted - Jul 05 2011 :  00:21:53  Show Profile  Reply
Hi Fabrizio,

Thank you for the patch ! It Works !

Go to Top of Page

Uwe

284 Posts

Posted - Jul 05 2011 :  12:34:56  Show Profile  Reply
The patch doesn't work - at least not in Vista Home Premium 32bit (all updates applied). FastMM reports a memory error every time I try to open the image.

Error: "FastMM has detected an error during a FreeMem operation. The block footer has been corrupted."


I tried to upload a screenshot, BTW, but your forum software crashes with a Microsoft VBScript runtime error '800a004c'...

Go to Top of Page

fab

1310 Posts

Posted - Jul 05 2011 :  14:11:44  Show Profile  Reply
Uwe,
please could post a link to the image you are testing?
Go to Top of Page

Uwe

284 Posts

Posted - Jul 05 2011 :  14:31:29  Show Profile  Reply
Fabrizio, it's the image that was mentioned in the third post from the top.

http://update.sidexa.fr/PO/PVSE/P0003.JPG
Go to Top of Page

fab

1310 Posts

Posted - Jul 05 2011 :  15:24:54  Show Profile  Reply
In this case I am unable to replicate. Do you just load the jpeg using, for example:

ImageEnView.IO.LoadFromFile(...);

Go to Top of Page

Uwe

284 Posts

Posted - Jul 05 2011 :  16:53:34  Show Profile  Reply
Yes, plain and simple

ImageEnVect1.IO.LoadFromFile()


Here's some more info coming from FastMM:

--------------------------------------------------------
FastMM has detected an error during a FreeMem operation. The block footer has been corrupted.

The block size is: 374

This block was allocated by thread 0xFBC, and the stack trace (return addresses) at the time was:
40324E
5C3AB4
6CA237
5A7F26
68CA74
68CD6F
9BAD96
9B6067
57EB59
476B24
7AA16B

The block is currently used for an object of class: Unknown

The allocation number is: 371400

The block was previously freed by thread 0xF54, and the stack trace (return addresses) at the time was:
40326A
6FD9E4
737D57
54DDAE
54D964
77B9D0E9 [BaseThreadInitThunk]
77C716C3 [Unknown function at RtlInitializeExceptionChain]
77C71696 [Unknown function at RtlInitializeExceptionChain]

The current thread ID is 0xFBC, and the stack trace (return addresses) leading to this error is:
40326A
6CA28F
5A7F26
68CA74
68CD6F
9BAD96
9B6067
57EB59
476B24
7AA16B
7A2AB3

Current memory dump of 256 bytes starting at pointer address 7FF77AB0:
46 55 4A 49 46 49 4C 4D 1A 00 00 00 07 00 04 00 00 00 30 31 33 30 10 00 02 00 1F 00 00 00 3E 01
00 00 00 00 00 00 00 00 00 00 5E 01 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00
00 00 00 00 00 00 66 01 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 40 01 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00
F U J I F I L M . . . . . . . . . . 0 1 3 0 . . . . . . . . > .
. . . . . . . . . . ^ . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . f . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . @ . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Go to Top of Page

fab

1310 Posts

Posted - Jul 06 2011 :  11:07:09  Show Profile  Reply
Please make sure you have applied correctly both the patches, because I still cannot replicate it.
Go to Top of Page

Uwe

284 Posts

Posted - Jul 06 2011 :  11:27:54  Show Profile  Reply
I did, Fabrizio.


The bug can be traced to line 20174 in procedure TIETagsHandler.Clear in hyieutils.pas:

if assigned(fUnparsedData) then
freemem(fUnparsedData); <--------- here

D2007 Pro (all updates applied), latest ImageEn version
Go to Top of Page

fab

1310 Posts

Posted - Jul 06 2011 :  12:11:38  Show Profile  Reply
Uwe,
I just sent you an email with an ImageEn test version.

Go to Top of Page

Uwe

284 Posts

Posted - Jul 06 2011 :  19:40:59  Show Profile  Reply
Thanks, Fabrizio, just received it. Give me a few days for the test. In the meantime, I took a closer look at the image, and it seems that there's something wrong with its maker notes. I get a warning for an "Unknown format for MakerNotes tag 0x0"
Go to Top of Page

jcrochet

9 Posts

Posted - Jul 21 2011 :  08:49:06  Show Profile  Reply
Hi Fabrizio,

I come back again with my JUFIFILM pictures problem ! :(

Here is a little delphi 2007 project with ImageEN 3.1.2 patched.
http://update.sidexa.fr/PO/ImageEN/Projets2.zip

This project loads 31 FUJIFILM pictures inside a TImageEnMView component.
One button clear all pictures from the component with a while loop and a "Application.ProcessMessages" call for each pictures.

When I click on the button, I got an Access Violation inside :

destructor TIOParams.Destroy;
begin
  FreeAndNil(fEXIF_Tags);
  FreeAndNil(fEXIF_MakerNote);  -->> ACCESS VIOLATION HERE
  ...
end;


Some information to help you:

If I move the vertical scrollbar to the bottom and then click on the Delete button, there is no access violation.

If a remove the "Application.ProcessMessages" there is no error.

If I load other pictures from other manufacturer there is no error.

Regards,
Julien
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
Jump To: