Skip to content

Commit 49a2a76

Browse files
author
Daniel Lemire
committed
exposing bug
1 parent aa155ae commit 49a2a76

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/Base64DecodingTests.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,18 @@ protected static void Issue511(Base64WithWhiteSpaceToBinary Base64WithWhiteSpace
250250
{
251251
ArgumentNullException.ThrowIfNull(Base64WithWhiteSpaceToBinary);
252252

253-
// 0x7f is not a valid base64 character.
254-
byte[] base64Bytes = [0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
255-
0x20, 0x20, 0x7f, 0x57, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
253+
byte[] base64Bytes = [0x7f, 0x57, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,
254+
0x5a, 0x5a, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57,
255+
0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57,
256+
0x57, 0x57, 0x57, 0x57, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
256257
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
257-
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
258-
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
259-
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
260-
0x20, 0x20, 0x20, 0x5a];
258+
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x5a,
259+
0x20, 0x5a, 0x5a, 0x5a];
261260
ReadOnlySpan<byte> base64Span = new ReadOnlySpan<byte>(base64Bytes);
262261
int bytesConsumed;
263262
int bytesWritten;
264263
byte[] buffer = new byte[48];
265-
var result = Base64WithWhiteSpaceToBinary(base64Span, buffer, out bytesConsumed, out bytesWritten, false);
264+
var result = Base64WithWhiteSpaceToBinary(base64Span, buffer, out bytesConsumed, out bytesWritten, true);
266265
Assert.Equal(OperationStatus.InvalidData, result);
267266

268267
}

0 commit comments

Comments
 (0)