oozcitak / exiflibrary

A .Net Standard library for editing Exif metadata
MIT License
134 stars 48 forks source link

Image fails to Load due to ArgumentException #64

Closed devedse closed 5 years ago

devedse commented 5 years ago

This image fails to load due to the following exception:

Brokenstickman.JPG
Exception happened when optimizing or comparing the image:
System.ArgumentException: Source array was not long enough. Check the source index, length, and the array's lower bounds.
Parameter name: sourceArray
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
   at ExifLibrary.BitConverterEx.CheckData(Byte[] value, Int64 startIndex, Int64 length, ByteOrder from, ByteOrder to) in C:\XGit\exiflibrary\ExifLibrary\BitConverterEx.cs:line 401
   at ExifLibrary.BitConverterEx.ToUInt32(Byte[] value, Int64 startIndex, ByteOrder from, ByteOrder to) in C:\XGit\exiflibrary\ExifLibrary\BitConverterEx.cs:line 117
   at ExifLibrary.JPEGFile.ReadExifAPP1() in C:\XGit\exiflibrary\ExifLibrary\JPEGFile.cs:line 463
   at ExifLibrary.JPEGFile..ctor(MemoryStream stream, Encoding encoding, Boolean readTrailingData) in C:\XGit\exiflibrary\ExifLibrary\JPEGFile.cs:line 157
   at ExifLibrary.ImageFile.FromStreamInternal(MemoryStream stream, Encoding encoding) in C:\XGit\exiflibrary\ExifLibrary\ImageFile.cs:line 278
   at ExifLibrary.ImageFile.FromStream(Stream stream, Encoding encoding) in C:\XGit\exiflibrary\ExifLibrary\ImageFile.cs:line 175
   at ExifLibrary.ImageFile.FromFile(String filename, Encoding encoding) in C:\XGit\exiflibrary\ExifLibrary\ImageFile.cs:line 142
   at ExifLibrary.ImageFile.FromFile(String filename) in C:\XGit\exiflibrary\ExifLibrary\ImageFile.cs:line 129
   at DeveImageOptimizer.Helpers.ExifImageRotator.UnrotateImage(String path) in C:\XKanWeg\##TempImageOptimizerFailingImagesInvest\DeveImageOptimizer\DeveImageOptimizer\Helpers\ExifImageRotator.cs:line 20
   at DeveImageOptimizer.Helpers.ExifImageRotator.<>c__DisplayClass0_0.<UnrotateImageAsync>b__0() in C:\XKanWeg\##TempImageOptimizerFailingImagesInvest\DeveImageOptimizer\DeveImageOptimizer\Helpers\ExifImageRotator.cs:line 14
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
   at DeveImageOptimizer.Helpers.ExifImageRotator.UnrotateImageAsync(String path) in C:\XKanWeg\##TempImageOptimizerFailingImagesInvest\DeveImageOptimizer\DeveImageOptimizer\Helpers\ExifImageRotator.cs:line 12
   at DeveImageOptimizer.FileProcessing.FileOptimizerProcessor.OptimizeFile(String fileToOptimize, String originDirectory) in C:\XKanWeg\##TempImageOptimizerFailingImagesInvest\DeveImageOptimizer\DeveImageOptimizer\FileProcessing\FileOptimizerProcessor.cs:line 70

The failing image:

Brokenstickman

devedse commented 5 years ago

Thanks, I saw this was fixed. I'll retest later.

devedse commented 5 years ago

Can confirm this is now resolved: https://ci.appveyor.com/project/devedse/deveimageoptimizer/builds/28106287