[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-lib/master] Accept dates at least until signed 32-bit timestamps run out.



commit bca3d4cd30dabd50c57db96ef8ee806745081ea0
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Apr 17 18:10:44 2012 +0200

    Accept dates at least until signed 32-bit timestamps run out.
---
 .../torproject/descriptor/impl/ParseHelper.java    |    2 +-
 .../descriptor/impl/ServerDescriptorImplTest.java  |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/org/torproject/descriptor/impl/ParseHelper.java b/src/org/torproject/descriptor/impl/ParseHelper.java
index 8db09e2..daea018 100644
--- a/src/org/torproject/descriptor/impl/ParseHelper.java
+++ b/src/org/torproject/descriptor/impl/ParseHelper.java
@@ -142,7 +142,7 @@ public class ParseHelper {
     } catch (ParseException e) {
       /* Leave result at -1L. */
     }
-    if (result < 0L || result > 2000000000000L) {
+    if (result < 0L || result / 1000L > (long) Integer.MAX_VALUE) {
       throw new DescriptorParseException("Illegal timestamp format in "
           + "line '" + line + "'.");
     }
diff --git a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
index a96fa33..1407195 100644
--- a/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
+++ b/test/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
@@ -470,8 +470,8 @@ public class ServerDescriptorImplTest {
   }
 
   @Test(expected = DescriptorParseException.class)
-  public void testPublished3012() throws DescriptorParseException {
-    DescriptorBuilder.createWithPublishedLine("published 3012-01-01 "
+  public void testPublished2039() throws DescriptorParseException {
+    DescriptorBuilder.createWithPublishedLine("published 2039-01-01 "
         + "04:03:19");
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits