File tree Expand file tree Collapse file tree
src/test/org/apache/commons/codec/binary Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -73,11 +73,21 @@ public void testDecodePadMarkerIndex3() {
7373 public void testDecodePadOnly () {
7474 assertTrue (Base64 .decodeBase64 ("====" .getBytes ()).length == 0 );
7575 assertEquals ("" , new String (Base64 .decodeBase64 ("====" .getBytes ())));
76+ // Test truncated padding
77+ assertTrue (Base64 .decodeBase64 ("===" .getBytes ()).length == 0 );
78+ assertTrue (Base64 .decodeBase64 ("==" .getBytes ()).length == 0 );
79+ assertTrue (Base64 .decodeBase64 ("=" .getBytes ()).length == 0 );
80+ assertTrue (Base64 .decodeBase64 ("" .getBytes ()).length == 0 );
7681 }
7782
7883 public void testDecodePadOnlyChunked () {
7984 assertTrue (Base64 .decodeBase64 ("====\n " .getBytes ()).length == 0 );
8085 assertEquals ("" , new String (Base64 .decodeBase64 ("====\n " .getBytes ())));
86+ // Test truncated padding
87+ assertTrue (Base64 .decodeBase64 ("===\n " .getBytes ()).length == 0 );
88+ assertTrue (Base64 .decodeBase64 ("==\n " .getBytes ()).length == 0 );
89+ assertTrue (Base64 .decodeBase64 ("=\n " .getBytes ()).length == 0 );
90+ assertTrue (Base64 .decodeBase64 ("\n " .getBytes ()).length == 0 );
8191 }
8292
8393 // encode/decode random arrays from size 0 to size 11
You can’t perform that action at this time.
0 commit comments