Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Library
Commits
fadcaa4b
Commit
fadcaa4b
authored
May 29, 2017
by
Karsten Loesing
Browse files
Fix encoding bug in RelayDirectoryImpl and NetworkStatusImpl.
parent
232ea426
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
fadcaa4b
...
...
@@ -10,6 +10,10 @@
-
Move descriptor digest computation to DescriptorImpl.
-
Fix a bug in digest computation by making sure that the
descriptor string actually contains the end token.
-
Fix a bug where both RelayDirectoryImpl and all NetworkStatusImpl
subclasses fail to get indexes right if parts of raw descriptor
strings contain non-ASCII chars. In practice, this only affects
version 1 directories which were last archived in 2007.
# Changes in version 1.7.0 - 2017-05-17
...
...
src/main/java/org/torproject/descriptor/impl/NetworkStatusImpl.java
View file @
fadcaa4b
...
...
@@ -8,6 +8,7 @@ import org.torproject.descriptor.DirSourceEntry;
import
org.torproject.descriptor.DirectorySignature
;
import
org.torproject.descriptor.NetworkStatusEntry
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.SortedMap
;
...
...
@@ -33,7 +34,8 @@ public abstract class NetworkStatusImpl extends DescriptorImpl {
if
(
this
.
rawDescriptorBytes
.
length
==
0
)
{
throw
new
DescriptorParseException
(
"Descriptor is empty."
);
}
String
descriptorString
=
new
String
(
rawDescriptorBytes
);
String
descriptorString
=
new
String
(
rawDescriptorBytes
,
StandardCharsets
.
US_ASCII
);
int
firstRIndex
=
this
.
findFirstIndexOfKeyword
(
descriptorString
,
Key
.
R
.
keyword
);
int
endIndex
=
descriptorString
.
length
();
...
...
src/main/java/org/torproject/descriptor/impl/RelayDirectoryImpl.java
View file @
fadcaa4b
...
...
@@ -8,6 +8,7 @@ import org.torproject.descriptor.RelayDirectory;
import
org.torproject.descriptor.RouterStatusEntry
;
import
org.torproject.descriptor.ServerDescriptor
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.EnumSet
;
import
java.util.List
;
...
...
@@ -56,7 +57,8 @@ public class RelayDirectoryImpl extends DescriptorImpl
if
(
this
.
rawDescriptorBytes
.
length
==
0
)
{
throw
new
DescriptorParseException
(
"Descriptor is empty."
);
}
String
descriptorString
=
new
String
(
rawDescriptorBytes
);
String
descriptorString
=
new
String
(
rawDescriptorBytes
,
StandardCharsets
.
US_ASCII
);
int
startIndex
=
0
;
int
firstRouterIndex
=
this
.
findFirstIndexOfKeyword
(
descriptorString
,
Key
.
ROUTER
.
keyword
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment