Skip to content

Commit c82fe35

Browse files
committed
CODEC-200 - Base32.HEX_DECODE_TABLE contains the wrong value 32
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1683550 13f79535-47bb-0310-9956-ffa450edef68
1 parent 38357df commit c82fe35

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/changes/changes.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0"?>
22
<!--
33
Licensed to the Apache Software Foundation (ASF) under one or more
44
contributor license agreements. See the NOTICE file distributed with
@@ -39,10 +39,11 @@ The <action> type attribute can be add,update,fix,remove.
3939
<document>
4040
<properties>
4141
<title>Changes</title>
42-
<author>Gary Gregory</author>
42+
<author>Apache Commons Developers</author>
4343
</properties>
4444
<body>
4545
<release version="1.11" date="DD MM 2015" description="Feature and fix release.">
46+
<action issue="CODEC-200" dev="sebb" type="fix" due-to="Luciano Vernaschi">Base32.HEX_DECODE_TABLE contains the wrong value 32</action>
4647
<action dev="ggregory" type="add" issue="CODEC-199" due-to="Yossi Tamari">Bug in HW rule in Soundex</action>
4748
<action dev="ggregory" type="add" issue="CODEC-183" due-to="Steven Wurster">BaseNCodecOutputStream only supports writing EOF on close()</action>
4849
<action dev="ggregory" type="add" issue="CODEC-195" due-to="Gary Gregory">Support SHA-224 in DigestUtils on Java 8</action>

src/main/java/org/apache/commons/codec/binary/Base32.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public class Base32 extends BaseNCodec {
7070
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10-1f
7171
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20-2f
7272
-1, -1, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, // 30-3f 2-7
73-
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40-4f A-N
74-
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 50-5a O-Z
73+
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 40-4f A-O
74+
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // 50-5a P-Z
7575
};
7676

7777
/**
@@ -95,8 +95,8 @@ public class Base32 extends BaseNCodec {
9595
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10-1f
9696
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20-2f
9797
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, // 30-3f 2-7
98-
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 40-4f A-N
99-
25, 26, 27, 28, 29, 30, 31, 32, // 50-57 O-V
98+
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 40-4f A-O
99+
25, 26, 27, 28, 29, 30, 31, // 50-57 P-V
100100
};
101101

102102
/**

src/test/java/org/apache/commons/codec/binary/Base32Test.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package org.apache.commons.codec.binary;
2020

2121
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertNotNull;
2223
import static org.junit.Assert.fail;
2324

2425
import java.util.Arrays;
@@ -151,4 +152,11 @@ public void testBase32SamplesNonDefaultPadding() throws Exception {
151152
assertEquals(element[1], codec.encodeAsString(element[0].getBytes(Charsets.UTF_8)));
152153
}
153154
}
155+
156+
@Test
157+
public void testCodec200() {
158+
final Base32 codec = new Base32(true, (byte)'W'); // should be allowed
159+
assertNotNull(codec);
160+
}
161+
154162
}

0 commit comments

Comments
 (0)