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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 The program enters an infinite loop when reading Exif

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Sviat Posted - Sep 26 2024 : 09:37:18
Delphi 12.2
Target platform: Win64
Configuration: Release

With optimization enabled (Release configuration), the program enters an infinite loop when reading Exif data from an attached image.
This happens because the number of bytes read is not checked in the IEStreamReadWord, IEStreamReadDWord, IEStreamReadInt64 functions.

The correct solution: check the result of Stream.Read
Simple solution: Resilt:=0 before Stream.Read


procedure TestBug_Full;
begin
  var ImageEnIO := TImageEnIO.Create(nil);
  try
    IEGlobalSettings().JPEGEngine := iecrLibRaw;
    ImageEnIO.ParamsFromFile('BUG.jpeg', ioJPEG);
  finally
    ImageEnIO.Free;
  end;
end;

procedure TestBug_Short;
const ExifData: TBytes = [
  69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,4,1,15,0,2,0,0,0,6,0,0,0,62,1,16,0,2,0,0,0,13,0,0,0,
  68,130,154,0,5,0,0,0,1,0,0,0,81,135,105,0,4,0,0,0,1,0,0,0,89,0,0,0,0,67,97,110,111,110,0,67,97,
  110,111,110,32,69,79,83,32,54,68,0,0,0,0,30,0,0,0,1,0,6,130,154,0,5,0,0,0,1,0,0,0,163,130,157,0,
  5,0,0,0,1,0,0,0,171,136,39,0,3,0,0,0,2,0,100,0,0,144,3,0,2,0,0,0,20,0,0,0,179,146,9,0,3,0,0,
  0,2,0,16,0,0,146,10,0,5,0,0,0,1,0,0,0,199,0,0,0,30,0,0,0,1,0,0,0,22,0,0,0,1,50,48,49,52,58,
  48,52,58,49,56,32,48,51,58,52,48,58,51,57,0,0,0,0,17,0,0,0,1
];
begin
  var Params := TIOParams.Create;
  try
    LoadEXIFFromStandardBuffer(Pointer(ExifData), Length(ExifData), Params, True);
  finally
    Params.Free;
  end;
end;


attach/Sviat/20249269371_BUG.zip
40.02 KB
1   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Sep 26 2024 : 19:15:04
Thank you, we'll have a fix for this in our upcoming release.

Nigel
Xequte Software
www.imageen.com