From 6f10d426cd3341bb00083fc4201a3e35c00f450b Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Wed, 11 Dec 2013 14:14:20 +0000 Subject: [PATCH] limit the depth of recursion in regex because it breaks under Solaris --- magic/Magdir/assembler | 16 ++++++++-------- magic/Magdir/images | 38 +++++++++++++++++++------------------- magic/Magdir/python | 6 +++--- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/magic/Magdir/assembler b/magic/Magdir/assembler index 37924e3b..efa8e19d 100644 --- a/magic/Magdir/assembler +++ b/magic/Magdir/assembler @@ -1,18 +1,18 @@ #------------------------------------------------------------------------------ -# $File: assembler,v 1.4 2013/01/04 23:31:11 christos Exp $ +# $File: assembler,v 1.5 2013/09/17 17:33:36 christos Exp $ # make: file(1) magic for assembler source # -0 regex \^[\040\t]*\\.asciiz assembler source text +0 regex \^[\040\t]{0,50}\\.asciiz assembler source text !:mime text/x-asm -0 regex \^[\040\t]*\\.byte assembler source text +0 regex \^[\040\t]{0,50}\\.byte assembler source text !:mime text/x-asm -0 regex \^[\040\t]*\\.even assembler source text +0 regex \^[\040\t]{0,50}\\.even assembler source text !:mime text/x-asm -0 regex \^[\040\t]*\\.globl assembler source text +0 regex \^[\040\t]{0,50}\\.globl assembler source text !:mime text/x-asm -0 regex \^[\040\t]*\\.text assembler source text +0 regex \^[\040\t]{0,50}\\.text assembler source text !:mime text/x-asm -0 regex \^[\040\t]*\\.file assembler source text +0 regex \^[\040\t]{0,50}\\.file assembler source text !:mime text/x-asm -0 regex \^[\040\t]*\\.type assembler source text +0 regex \^[\040\t]{0,50}\\.type assembler source text !:mime text/x-asm diff --git a/magic/Magdir/images b/magic/Magdir/images index d07c0475..3b6294ed 100644 --- a/magic/Magdir/images +++ b/magic/Magdir/images @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: images,v 1.85 2013/09/27 23:30:39 christos Exp $ +# $File: images,v 1.86 2013/11/19 23:56:04 christos Exp $ # images: file(1) magic for image formats (see also "iff", and "c-lang" for # XPM bitmaps) # @@ -34,39 +34,39 @@ # The next byte following the magic is always whitespace. # strength is changed to try these patterns before "x86 boot sector" 0 search/1 P1 ->3 regex =[0-9]*\ [0-9]* Netpbm PBM image text ->3 regex =[0-9]+\ \b, size = %sx ->>3 regex =\ [0-9]+ \b%s +>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PBM image text +>3 regex =[0-9]{1,50}\ \b, size = %sx +>>3 regex =\ [0-9]{1,50} \b%s !:strength + 45 !:mime image/x-portable-bitmap 0 search/1 P2 ->3 regex =[0-9]*\ [0-9]* Netpbm PGM image text ->3 regex =[0-9]+\ \b, size = %sx ->>3 regex =\ [0-9]+ \b%s +>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PGM image text +>3 regex =[0-9]{1,50}\ \b, size = %sx +>>3 regex =\ [0-9]{1,50} \b%s !:strength + 45 !:mime image/x-portable-greymap 0 search/1 P3 ->3 regex =[0-9]*\ [0-9]* Netpbm PPM image text ->3 regex =[0-9]+\ \b, size = %sx ->>3 regex =\ [0-9]+ \b%s +>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PPM image text +>3 regex =[0-9]{1,50}\ \b, size = %sx +>>3 regex =\ [0-9]{1,50} \b%s !:strength + 45 !:mime image/x-portable-pixmap 0 string P4 ->3 regex =[0-9]*\ [0-9]* Netpbm PBM "rawbits" image data ->3 regex =[0-9]+\ \b, size = %sx ->>3 regex =\ [0-9]+ \b%s +>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PBM "rawbits" image data +>3 regex =[0-9]{1,50}\ \b, size = %sx +>>3 regex =\ [0-9]{1,50} \b%s !:strength + 45 !:mime image/x-portable-bitmap 0 string P5 ->3 regex =[0-9]*\ [0-9]* Netpbm PGM "rawbits" image data ->3 regex =[0-9]+\ \b, size = %sx ->>3 regex =\ [0-9]+ \b%s +>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PGM "rawbits" image data +>3 regex =[0-9]{1,50}\ \b, size = %sx +>>3 regex =\ [0-9]{1,50} \b%s !:strength + 45 !:mime image/x-portable-greymap 0 string P6 ->3 regex =[0-9]*\ [0-9]* Netpbm PPM "rawbits" image data ->3 regex =[0-9]+\ \b, size = %sx ->>3 regex =\ [0-9]+ \b%s +>3 regex =[0-9]{0,50}\ [0-9]{0,50} Netpbm PPM "rawbits" image data +>3 regex =[0-9]{1,50}\ \b, size = %sx +>>3 regex =\ [0-9]{1,50} \b%s !:strength + 45 !:mime image/x-portable-pixmap 0 string P7 Netpbm PAM image file diff --git a/magic/Magdir/python b/magic/Magdir/python index 61ca0f74..081dbe98 100644 --- a/magic/Magdir/python +++ b/magic/Magdir/python @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: python,v 1.21 2012/06/21 01:12:51 christos Exp $ +# $File: python,v 1.22 2013/03/18 12:49:55 christos Exp $ # python: file(1) magic for python # # Outlook puts """ too for urgent messages @@ -62,6 +62,6 @@ !:mime text/x-python # def name(args, args): -0 regex \^(\ |\\t)*def\ +[a-zA-Z]+ ->&0 regex \ *\\(([a-zA-Z]|,|\ )*\\):$ Python script text executable +0 regex \^(\ |\\t){0,50}def\ {1,50}[a-zA-Z]{1,100} +>&0 regex \ {0,50}\\(([a-zA-Z]|,|\ ){1,500}\\):$ Python script text executable !:mime text/x-python -- 2.40.0