~ubuntu-branches/debian/sid/mawk/sid

« back to all changes in this revision

Viewing changes to debian/patches/20_overlong-regexps

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2012-03-23 13:15:00 UTC
  • Revision ID: package-import@ubuntu.com-20120323131500-cg247j3bymab8p4k
Tags: 1.3.3-17
* debian/patches/cross-compile: fix the wrong invocation of AC_CHECK_PROG()
  that breaks cross-compiler detection.
* debian/patches/21_memcpy-to-memmove: use memmove instead of memcpy in
  FINgets.  Closes: #665383, LP: #955791.
* mark mawk Multi-Arch: foreign, to satisfy cross-build-dependencies.
* debian/patches/20_overlong-regexps: Do not crash if regexp is too
  long for our buffer.  Thanks to Ian Jackson <iwj@ubuntu.com>,
  Jonathan Nieder <jrnieder@gmail.com>.  Closes: #391051, LP: #23494.
* add autopkgtest/autodebtest support to run upstream tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Do not crash if regexp is too long for our buffer
 
2
Author: Ian Jackson <iwj@ubuntu.com>, Jonathan Nieder <jrnieder@gmail.com>
 
3
Bug-Ubuntu: https://bugs.launchpad.net/bug/23494
 
4
Bug-Debian: http://bugs.debian.org/391051
 
5
 
 
6
--- a/scan.c
 
7
+++ b/scan.c
 
8
@@ -1033,6 +1033,15 @@
 
9
    STRING *sval ;
 
10
 
 
11
    while (1)
 
12
+   {
 
13
+      if (p >= string_buff + MIN_SPRINTF - 2)
 
14
+      {
 
15
+          compile_error(
 
16
+                         "regular expression /%.10s ..."
 
17
+                         " exceeds implementation size limit",
 
18
+                         string_buff) ;
 
19
+         mawk_exit(2) ;
 
20
+      }
 
21
       switch (scan_code[*p++ = next()])
 
22
       {
 
23
         case SC_DIV:           /* done */
 
24
@@ -1070,6 +1079,7 @@
 
25
            }
 
26
            break ;
 
27
       }
 
28
+   }
 
29
 
 
30
 out:
 
31
    /* now we've got the RE, so compile it */
 
32
--- a/test/mawktest
 
33
+++ b/test/mawktest
 
34
@@ -35,6 +35,13 @@
 
35
 
 
36
 cmp -s  reg-awk.out temp$$ || exit
 
37
 
 
38
+# 640 backslashes
 
39
+backslashes='\\\\\\\\\\'
 
40
+backslashes="$backslashes$backslashes$backslashes$backslashes"
 
41
+backslashes="$backslashes$backslashes$backslashes$backslashes"
 
42
+backslashes="$backslashes$backslashes$backslashes$backslashes"
 
43
+( set +e; LC_ALL=C mawk "/a$backslashes/" $dat; test $? -eq 2 ) || exit
 
44
+
 
45
 echo regular expression matching OK
 
46
 #######################################
 
47