From: Zdenek Dohnal Date: Fri, 26 Apr 2024 09:17:23 +0000 (+0200) Subject: Backport fix for mime.types limit (Issue #925) X-Git-Tag: v2.4.8~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eeaf1f32d1a8a6e56243c63950bdf9f34e9413c3;p=thirdparty%2Fcups.git Backport fix for mime.types limit (Issue #925) --- diff --git a/CHANGES.md b/CHANGES.md index 2871947b90..d8d8c409e4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Changes in CUPS v2.4.8 (TBA) successfully printed jobs (Issue #830) - Added support for PAM modules password-auth and system-auth (Issue #892) - Updated IPP Everywhere printer creation error reporting (Issue #347) +- Updated and documented the MIME typing buffering limit (Issue #925) - Raised `cups_enum_dests()` timeout for listing available IPP printers (Issue #751) - Now report an error for temporary printer defaults with lpadmin (Issue #237) diff --git a/conf/mime.types b/conf/mime.types index c8603b02ed..62c4889d4a 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -70,12 +70,12 @@ application/pdf pdf regex(0,^[\n\r]*%PDF) application/postscript ai eps ps string(0,%!) string(0,<04>%!) \ contains(0,128,<1B>%-12345X) + \ - (contains(0,4096,"LANGUAGE=POSTSCRIPT") \ - contains(0,4096,"LANGUAGE = Postscript") \ - contains(0,4096,"LANGUAGE = PostScript") \ - contains(0,4096,"LANGUAGE = POSTSCRIPT") \ - (contains(0,4096,<0a>%!) + \ - !contains(0,4096,"ENTER LANGUAGE"))) + (contains(0,8192,"LANGUAGE=POSTSCRIPT") \ + contains(0,8192,"LANGUAGE = Postscript") \ + contains(0,8192,"LANGUAGE = PostScript") \ + contains(0,8192,"LANGUAGE = POSTSCRIPT") \ + (contains(0,8192,<0a>%!) + \ + !contains(0,8192,"ENTER LANGUAGE"))) ######################################################################## @@ -156,8 +156,8 @@ application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \ string(0,<1B>@) \ (contains(0,128,<1B>%-12345X) + \ - (contains(0,4096,"LANGUAGE=PCL") \ - contains(0,4096,"LANGUAGE = PCL"))) + (contains(0,8192,"LANGUAGE=PCL") \ + contains(0,8192,"LANGUAGE = PCL"))) ######################################################################## # diff --git a/doc/help/man-mime.types.html b/doc/help/man-mime.types.html index f60fd56697..d10559fa13 100644 --- a/doc/help/man-mime.types.html +++ b/doc/help/man-mime.types.html @@ -36,9 +36,9 @@ The following functions are available:
match("pattern")
True if the filename matches the given shell wildcard pattern.
ascii(offset,length) -
True if the length bytes starting at offset are valid printable ASCII (CR, NL, TAB, BS, 32-126). +
True if the length bytes starting at offset are valid printable ASCII (CR, NL, TAB, BS, 32-126). length cannot exceed 8192 bytes.
printable(offset,length) -
True if the length bytes starting at offset are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). +
True if the length bytes starting at offset are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). length cannot exceed 8192 bytes.
priority(number)
Specifies the relative priority of this MIME media type. The default priority is 100. @@ -55,8 +55,8 @@ Larger values have higher priority while smaller values have lower priority.
True if the 32-bit big-endian integer at offset is identical to value.
locale("string")
True if current locale matches string. -
contains(offset,range,"string") -
True if the bytes starting at offset for range bytes contains string. +
contains(offset,length,"string") +
True if the bytes starting at offset for length bytes contains string. length cannot exceed 8192 bytes.

String Constants

String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings. diff --git a/man/mime.types.5 b/man/mime.types.5 index 18b6447f6e..d34cad5cc2 100644 --- a/man/mime.types.5 +++ b/man/mime.types.5 @@ -45,9 +45,11 @@ True if the filename matches the given shell wildcard \fIpattern\fR. .TP 5 \fBascii(\fIoffset\fB,\fIlength\fB)\fR True if the \fIlength\fR bytes starting at \fIoffset\fR are valid printable ASCII (CR, NL, TAB, BS, 32-126). +\fIlength\fR cannot exceed 8192 bytes. .TP 5 \fBprintable(\fIoffset\fB,\fIlength\fB)\fR True if the \fIlength\fR bytes starting at \fIoffset\fR are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). +\fIlength\fR cannot exceed 8192 bytes. .TP 5 \fBpriority(\fInumber\fB)\fR Specifies the relative priority of this MIME media type. @@ -72,8 +74,9 @@ True if the 32-bit big-endian integer at \fIoffset\fR is identical to \fIvalue\f \fBlocale("\fIstring\fB")\fR True if current locale matches \fIstring\fR. .TP 5 -\fBcontains(\fIoffset\fB,\fIrange\fB,"\fIstring\fB")\fR -True if the bytes starting at \fIoffset\fR for \fIrange\fR bytes contains \fIstring\fR. +\fBcontains(\fIoffset\fB,\fIlength\fB,"\fIstring\fB")\fR +True if the bytes starting at \fIoffset\fR for \fIlength\fR bytes contains \fIstring\fR. +\fIlength\fR cannot exceed 8192 bytes. .SS STRING CONSTANTS String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings. .SS TYPE MATCHING AND PRIORITY diff --git a/scheduler/mime.h b/scheduler/mime.h index d0d1559770..ba1a73a532 100644 --- a/scheduler/mime.h +++ b/scheduler/mime.h @@ -34,7 +34,7 @@ extern "C" { # define MIME_MAX_SUPER 16 /* Maximum size of supertype name */ # define MIME_MAX_TYPE IPP_MAX_NAME /* Maximum size of type name */ # define MIME_MAX_FILTER 256 /* Maximum size of filter pathname */ -# define MIME_MAX_BUFFER 4096 /* Maximum size of file buffer */ +# define MIME_MAX_BUFFER 8192 /* Maximum size of file buffer */ /*