mirror of
https://github.com/torproject/metrics-lib.git
synced 2024-11-23 17:29:49 +00:00
Fix encoding bug in RelayDirectoryImpl and NetworkStatusImpl.
This commit is contained in:
parent
232ea426b5
commit
fadcaa4b20
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user