Blame SOURCES/patch.r7030

a64d99
Index: bogofilter/src/lexer.c
a64d99
===================================================================
a64d99
--- bogofilter/src/lexer.c	(revision 7029)
a64d99
+++ bogofilter/src/lexer.c	(revision 7030)
a64d99
@@ -329,7 +329,7 @@
a64d99
 	count += cnt;
a64d99
 
a64d99
 	/* Note: some malformed messages can cause xfgetsl() to report
a64d99
-	** "Invalid buffer size, exiting."  ** and then abort.  This
a64d99
+	** "Invalid buffer size, exiting."  and then abort.  This
a64d99
 	** can happen when the parser is in html mode and there's a
a64d99
 	** leading '<' but no closing '>'.
a64d99
 	**
a64d99
@@ -343,9 +343,12 @@
a64d99
 
a64d99
 	if (count >= MAX_TOKEN_LEN * 2 && 
a64d99
 	    long_token(buff.t.u.text, (uint) count)) {
a64d99
-	    uint start = buff.t.leng - count;
a64d99
-	    uint length = count - max_token_len;
a64d99
-	    buff_shift(&buff, start, length);
a64d99
+	    /* Make sure not to shift bytes outside the buffer */
a64d99
+	    if (buff.t.leng >= (uint) count) {
a64d99
+		    uint start = buff.t.leng - count;
a64d99
+		    uint length = count - max_token_len;
a64d99
+		    buff_shift(&buff, start, length);
a64d99
+	    }
a64d99
 	    count = buff.t.leng;
a64d99
 	}
a64d99
 	else
a64d99
Index: bogofilter/NEWS
a64d99
===================================================================
a64d99
--- bogofilter/NEWS	(revision 7029)
a64d99
+++ bogofilter/NEWS	(revision 7030)
a64d99
@@ -15,6 +15,14 @@
a64d99
 
a64d99
 -------------------------------------------------------------------------------
a64d99
 
a64d99
+	2015-02-28
a64d99
+
a64d99
+	* Fix the lexer to not try to delete parts from HTML tokens if it is
a64d99
+	  reading garbage (for instance, binary files misdeclared as HTML).
a64d99
+	  This was exposed on Fedora 20 and 21 but not Ubuntu 14.04 (x86_64),
a64d99
+	  and is possibly related to its newer flex 2.5.37 that may have
a64d99
+	  changed the way it uses yyinput() a bit.  Reported by Matt Garretson.
a64d99
+
a64d99
 	2015-02-25
a64d99
 
a64d99
 	* Fix the lexer to handle MIME multipart messages properly when the