Skip to content

Commit c668373

Browse files
committed
Merge remote-tracking branch 'origin/main' into bp/fixapp1parsing
# Conflicts: # tests/ImageSharp.Tests/TestImages.cs
2 parents 29aa049 + e73f21f commit c668373

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/ImageSharp/Metadata/Profiles/Exif/Values/ExifValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ internal ExifValue(ExifValue other)
2929
{
3030
// All array types are value types so Clone() is sufficient here.
3131
var array = (Array)other.GetValue();
32-
this.TrySetValue(array.Clone());
32+
this.TrySetValue(array?.Clone());
3333
}
3434
}
3535

tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderTests.Metadata.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,19 @@ public void Decode_WithInvalidIptcTag_DoesNotThrowException<TPixel>(TestImagePro
301301
Assert.Null(ex);
302302
}
303303

304+
[Theory]
305+
[WithFile(TestImages.Jpeg.Issues.ExifNullArrayTag, PixelTypes.Rgba32)]
306+
public void Clone_WithNullRationalArrayTag_DoesNotThrowException<TPixel>(TestImageProvider<TPixel> provider)
307+
where TPixel : unmanaged, IPixel<TPixel>
308+
{
309+
Exception ex = Record.Exception(() =>
310+
{
311+
using Image<TPixel> image = provider.GetImage(JpegDecoder);
312+
var clone = image.Metadata.ExifProfile.DeepClone();
313+
});
314+
Assert.Null(ex);
315+
}
316+
304317
[Fact]
305318
public void EncodedStringTags_WriteAndRead()
306319
{

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ public static class Issues
263263
public const string MultipleApp01932 = "Jpg/issues/issue-1932-app0-resolution.jpg";
264264
public const string InvalidIptcTag = "Jpg/issues/Issue1942InvalidIptcTag.jpg";
265265
public const string Issue2057App1Parsing = "Jpg/issues/Issue2057-App1Parsing.jpg";
266+
public const string ExifNullArrayTag = "Jpg/issues/issue-2056-exif-null-array.jpg";
266267

267268
public static class Fuzz
268269
{
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)