[PATCH] Fix a couple of obvious 2-byte ASn limits

Faidon Liambotis paravoid at debian.org
Mon Jun 21 14:21:44 UTC 2010


re2dfa's MAX_AS was set to 65535, thus failing on expressions
containing 4-byte ASes, e.g.
    import:         from  AS197121 accept
                    AS197121 AND <^AS197121>;

Additionally, RPSL's RANGE_TOP (which is used as MAX_AS in regexp.cc)
was set to 65535. I couldn't pinpoint an exact problem, but smells like
a bug, hence adjust that to 2^32 too.

Finally, RE_INVALID_AS was an int and set to RANGE_TOP + 1. Make it an
unsigned int and set it to 0, since it's only used for comparison in a
couple of assert() statements.
---
 src/re2dfa/re2dfa.h     |    2 +-
 src/re2dfa/regexp_nf.hh |    2 +-
 src/rpsl/rangelist.hh   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/re2dfa/re2dfa.h b/src/re2dfa/re2dfa.h
index e0cfd38..b67905e 100644
--- a/src/re2dfa/re2dfa.h
+++ b/src/re2dfa/re2dfa.h
@@ -48,7 +48,7 @@
 
 #include "config.h"
 
-#define MAX_AS 65535
+#define MAX_AS 4294967295
 
 /*
  * The following is a compile time limit on the number of NFA states
diff --git a/src/re2dfa/regexp_nf.hh b/src/re2dfa/regexp_nf.hh
index e1f7edf..2a7cdab 100644
--- a/src/re2dfa/regexp_nf.hh
+++ b/src/re2dfa/regexp_nf.hh
@@ -55,7 +55,7 @@
 #include "rpsl/rpsl_item.hh"
 
 typedef unsigned int ASt;
-const int RE_INVALID_AS = RANGE_TOP + 1;
+const unsigned int RE_INVALID_AS = 0;
 
 extern "C" {
 #include "re2dfa.h"
diff --git a/src/rpsl/rangelist.hh b/src/rpsl/rangelist.hh
index 5e3f9d8..2e87246 100644
--- a/src/rpsl/rangelist.hh
+++ b/src/rpsl/rangelist.hh
@@ -52,7 +52,7 @@
 #include <iostream>
 #include "List.hh"
 
-#define RANGE_TOP 65535
+#define RANGE_TOP 4294967295
 
 class RangeList {
 friend class regexp_nf;
-- 
1.7.0




More information about the irrtoolset mailing list