Browse Source
Merge branch 'main' into js/gif-fixes
pull/2455/head
James Jackson-South
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
1 deletions
-
src/ImageSharp/Formats/Pbm/BufferedReadStreamExtensions.cs
-
tests/ImageSharp.Tests/Formats/Pbm/PbmMetadataTests.cs
|
|
|
@ -28,7 +28,7 @@ internal static class BufferedReadStreamExtensions |
|
|
|
{ |
|
|
|
innerValue = stream.ReadByte(); |
|
|
|
} |
|
|
|
while (innerValue != 0x0a); |
|
|
|
while (innerValue is not 0x0a and not -0x1); |
|
|
|
|
|
|
|
// Continue searching for whitespace.
|
|
|
|
val = innerValue; |
|
|
|
|
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
|
|
|
|
using SixLabors.ImageSharp.Formats; |
|
|
|
using SixLabors.ImageSharp.Formats.Pbm; |
|
|
|
using static SixLabors.ImageSharp.Tests.TestImages.Pbm; |
|
|
|
|
|
|
|
@ -80,4 +81,14 @@ public class PbmMetadataTests |
|
|
|
Assert.NotNull(bitmapMetadata); |
|
|
|
Assert.Equal(expectedComponentType, bitmapMetadata.ComponentType); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Identify_HandlesCraftedDenialOfServiceString() |
|
|
|
{ |
|
|
|
byte[] bytes = Convert.FromBase64String("UDEjWAAACQAAAAA="); |
|
|
|
ImageInfo info = Image.Identify(bytes); |
|
|
|
Assert.Equal(default, info.Size); |
|
|
|
Configuration.Default.ImageFormatsManager.TryFindFormatByFileExtension("pbm", out IImageFormat format); |
|
|
|
Assert.Equal(format!, info.Metadata.DecodedImageFormat); |
|
|
|
} |
|
|
|
} |
|
|
|
|