mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Fix VP8X reserved bytes use Position += 3 instead of Write, causing 3-byte truncation in alpha WebP imagespull/3040/head
committed by
GitHub
2 changed files with 30 additions and 1 deletions
@ -0,0 +1,26 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Six Labors Split License.
|
|||
|
|||
using SixLabors.ImageSharp.Formats.Webp.Chunks; |
|||
|
|||
namespace SixLabors.ImageSharp.Tests.Formats.WebP; |
|||
|
|||
[Trait("Format", "Webp")] |
|||
public class WebpVp8XTests |
|||
{ |
|||
[Fact] |
|||
public void WebpVp8X_WriteTo_Writes_Reserved_Bytes() |
|||
{ |
|||
// arrange
|
|||
WebpVp8X header = new(false, false, false, false, false, 10, 40); |
|||
MemoryStream ms = new(); |
|||
byte[] expected = [86, 80, 56, 88, 10, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 39, 0, 0]; |
|||
|
|||
// act
|
|||
header.WriteTo(ms); |
|||
|
|||
// assert
|
|||
byte[] actual = ms.ToArray(); |
|||
Assert.Equal(expected, actual); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue