Skip to content

Commit eeaf1f3

Browse files
committed
Backport fix for mime.types limit (Issue #925)
1 parent 66a8e47 commit eeaf1f3

5 files changed

Lines changed: 19 additions & 15 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Changes in CUPS v2.4.8 (TBA)
1010
successfully printed jobs (Issue #830)
1111
- Added support for PAM modules password-auth and system-auth (Issue #892)
1212
- Updated IPP Everywhere printer creation error reporting (Issue #347)
13+
- Updated and documented the MIME typing buffering limit (Issue #925)
1314
- Raised `cups_enum_dests()` timeout for listing available IPP printers
1415
(Issue #751)
1516
- Now report an error for temporary printer defaults with lpadmin (Issue #237)

conf/mime.types

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@
7070
application/pdf pdf regex(0,^[\n\r]*%PDF)
7171
application/postscript ai eps ps string(0,%!) string(0,<04>%!) \
7272
contains(0,128,<1B>%-12345X) + \
73-
(contains(0,4096,"LANGUAGE=POSTSCRIPT") \
74-
contains(0,4096,"LANGUAGE = Postscript") \
75-
contains(0,4096,"LANGUAGE = PostScript") \
76-
contains(0,4096,"LANGUAGE = POSTSCRIPT") \
77-
(contains(0,4096,<0a>%!) + \
78-
!contains(0,4096,"ENTER LANGUAGE")))
73+
(contains(0,8192,"LANGUAGE=POSTSCRIPT") \
74+
contains(0,8192,"LANGUAGE = Postscript") \
75+
contains(0,8192,"LANGUAGE = PostScript") \
76+
contains(0,8192,"LANGUAGE = POSTSCRIPT") \
77+
(contains(0,8192,<0a>%!) + \
78+
!contains(0,8192,"ENTER LANGUAGE")))
7979

8080

8181
########################################################################
@@ -156,8 +156,8 @@ application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \
156156
application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \
157157
string(0,<1B>@) \
158158
(contains(0,128,<1B>%-12345X) + \
159-
(contains(0,4096,"LANGUAGE=PCL") \
160-
contains(0,4096,"LANGUAGE = PCL")))
159+
(contains(0,8192,"LANGUAGE=PCL") \
160+
contains(0,8192,"LANGUAGE = PCL")))
161161

162162
########################################################################
163163
#

doc/help/man-mime.types.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ <h3><a name="RULES">Rules</a></h3>
3636
<dt><b>match("</b><i>pattern</i><b>")</b>
3737
<dd style="margin-left: 5.0em">True if the filename matches the given shell wildcard <i>pattern</i>.
3838
<dt><b>ascii(</b><i>offset</i><b>,</b><i>length</i><b>)</b>
39-
<dd style="margin-left: 5.0em">True if the <i>length</i> bytes starting at <i>offset</i> are valid printable ASCII (CR, NL, TAB, BS, 32-126).
39+
<dd style="margin-left: 5.0em">True if the <i>length</i> bytes starting at <i>offset</i> are valid printable ASCII (CR, NL, TAB, BS, 32-126). <i>length</i> cannot exceed 8192 bytes.
4040
<dt><b>printable(</b><i>offset</i><b>,</b><i>length</i><b>)</b>
41-
<dd style="margin-left: 5.0em">True if the <i>length</i> bytes starting at <i>offset</i> are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254).
41+
<dd style="margin-left: 5.0em">True if the <i>length</i> bytes starting at <i>offset</i> are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). <i>length</i> cannot exceed 8192 bytes.
4242
<dt><b>priority(</b><i>number</i><b>)</b>
4343
<dd style="margin-left: 5.0em">Specifies the relative priority of this MIME media type.
4444
The default priority is 100.
@@ -55,8 +55,8 @@ <h3><a name="RULES">Rules</a></h3>
5555
<dd style="margin-left: 5.0em">True if the 32-bit big-endian integer at <i>offset</i> is identical to <i>value</i>.
5656
<dt><b>locale("</b><i>string</i><b>")</b>
5757
<dd style="margin-left: 5.0em">True if current locale matches <i>string</i>.
58-
<dt><b>contains(</b><i>offset</i><b>,</b><i>range</i><b>,"</b><i>string</i><b>")</b>
59-
<dd style="margin-left: 5.0em">True if the bytes starting at <i>offset</i> for <i>range</i> bytes contains <i>string</i>.
58+
<dt><b>contains(</b><i>offset</i><b>,</b><i>length</i><b>,"</b><i>string</i><b>")</b>
59+
<dd style="margin-left: 5.0em">True if the bytes starting at <i>offset</i> for <i>length</i> bytes contains <i>string</i>. <i>length</i> cannot exceed 8192 bytes.
6060
</dl>
6161
<h3><a name="STRING_CONSTANTS">String Constants</a></h3>
6262
String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (&lt;>) for hexadecimal strings.

man/mime.types.5

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ True if the filename matches the given shell wildcard \fIpattern\fR.
4545
.TP 5
4646
\fBascii(\fIoffset\fB,\fIlength\fB)\fR
4747
True if the \fIlength\fR bytes starting at \fIoffset\fR are valid printable ASCII (CR, NL, TAB, BS, 32-126).
48+
\fIlength\fR cannot exceed 8192 bytes.
4849
.TP 5
4950
\fBprintable(\fIoffset\fB,\fIlength\fB)\fR
5051
True if the \fIlength\fR bytes starting at \fIoffset\fR are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254).
52+
\fIlength\fR cannot exceed 8192 bytes.
5153
.TP 5
5254
\fBpriority(\fInumber\fB)\fR
5355
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
7274
\fBlocale("\fIstring\fB")\fR
7375
True if current locale matches \fIstring\fR.
7476
.TP 5
75-
\fBcontains(\fIoffset\fB,\fIrange\fB,"\fIstring\fB")\fR
76-
True if the bytes starting at \fIoffset\fR for \fIrange\fR bytes contains \fIstring\fR.
77+
\fBcontains(\fIoffset\fB,\fIlength\fB,"\fIstring\fB")\fR
78+
True if the bytes starting at \fIoffset\fR for \fIlength\fR bytes contains \fIstring\fR.
79+
\fIlength\fR cannot exceed 8192 bytes.
7780
.SS STRING CONSTANTS
7881
String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings.
7982
.SS TYPE MATCHING AND PRIORITY

scheduler/mime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ extern "C" {
3434
# define MIME_MAX_SUPER 16 /* Maximum size of supertype name */
3535
# define MIME_MAX_TYPE IPP_MAX_NAME /* Maximum size of type name */
3636
# define MIME_MAX_FILTER 256 /* Maximum size of filter pathname */
37-
# define MIME_MAX_BUFFER 4096 /* Maximum size of file buffer */
37+
# define MIME_MAX_BUFFER 8192 /* Maximum size of file buffer */
3838

3939

4040
/*

0 commit comments

Comments
 (0)