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
13 additions and
1 deletions
-
src/ImageSharp/Formats/Pbm/BufferedReadStreamExtensions.cs
-
tests/ImageSharp.Tests/Formats/Pbm/PbmMetadataTests.cs
|
|
|
@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Formats.Pbm |
|
|
|
{ |
|
|
|
innerValue = stream.ReadByte(); |
|
|
|
} |
|
|
|
while (innerValue != 0x0a); |
|
|
|
while (innerValue is not 0x0a and not -0x1); |
|
|
|
|
|
|
|
// Continue searching for whitespace.
|
|
|
|
val = innerValue; |
|
|
|
|
|
|
|
@ -1,7 +1,9 @@ |
|
|
|
// Copyright (c) Six Labors.
|
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using SixLabors.ImageSharp.Formats; |
|
|
|
using SixLabors.ImageSharp.Formats.Pbm; |
|
|
|
|
|
|
|
using Xunit; |
|
|
|
@ -82,5 +84,15 @@ namespace SixLabors.ImageSharp.Tests.Formats.Pbm |
|
|
|
Assert.NotNull(bitmapMetadata); |
|
|
|
Assert.Equal(expectedComponentType, bitmapMetadata.ComponentType); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void Identify_HandlesCraftedDenialOfServiceString() |
|
|
|
{ |
|
|
|
byte[] bytes = Convert.FromBase64String("UDEjWAAACQAAAAA="); |
|
|
|
IImageInfo info = Image.Identify(bytes); |
|
|
|
Assert.Equal(default, info.Size()); |
|
|
|
IImageFormat format = Configuration.Default.ImageFormatsManager.FindFormatByFileExtension("pbm"); |
|
|
|
Assert.Equal("PBM", format.Name); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|