Dave Barker [Fri, 12 May 2023 09:39:52 +0000 (10:39 +0100)]
Fix check for existing color mode setting
Colour mode selection is not persisted correctly across restarts. Current check is for "printer-color-mode", but every other reference to this option is "print-color-mode" (no "er"). This was causing the selected colour mode to be reset to the PPD default on restart.
Rose [Fri, 20 Jan 2023 17:47:21 +0000 (12:47 -0500)]
Improve state handling in cases of memory allocation failure
Many lines of code assume that malloc will not fail. In cases where it does, sometimes the program does not know, and as a result, memory can leak and more disastrous consequences can happen before the program ultimately finds something is wrong and then calls exit();
Rose [Sun, 23 Apr 2023 17:09:50 +0000 (13:09 -0400)]
UBSan: Array over-read when operating on _fields
We are reading outside of the _fields boundaries and onto other fields when we iterate across all the fields, rather than comparing just those that are within _fields, and then always freeing the ones that are not.
Rose [Sun, 23 Apr 2023 16:25:39 +0000 (12:25 -0400)]
UBSan: Contain pos - fp->bufpos in parentheses
Yes I know this shouldn't change the behavior in theory, but clang insists it does in practice, so to quiet the UBSan, I put parentheses around pos - fp->bufpos.
cups/http-addr.c: Set listen backlog size to INT_MAX (fixes #308)
Use a listen queue size of INT_MAX, which should default to the maximum
supported queue size on the system.
This avoids the problem of the listening backlog queue getting full when
there are too many requests at the same time. The problem was observed
with the previous backlog size (128) by customers when submitting large
batches of print jobs, resulting in some jobs getting lost.
Till Kamppeter [Wed, 15 Feb 2023 21:01:05 +0000 (22:01 +0100)]
In auto-generated PPDs do not set RGB default on mono printers
When a PPD for a driverless printer is generated by the
_ppdCreateFromIPP2() function and the get-printer-attributes IPP
response gives "print-color-mode-default=auto" the PPD's default
setting for "ColorModel" is always "RGB", even on monochrome printers,
which makes printing fail on most devices.
Now we ignore the "print-color-mode-default" if set to "auto" and
proceed as if no default was given, finding the default by selecting
the most desirable of the existing "ColorModel" choices.
Benjamin Gordon [Wed, 1 Feb 2023 17:01:42 +0000 (10:01 -0700)]
Fix UB in cups_raster_read debug message
The first time `cups_raster_read` is called, both `r->bufptr` and
`r->buffer` are NULL. The calculation here then ends up looking like
adding a size_t to a NULL pointer, which triggers the ubsan detector.
Since we just want an offset, cast the pointer difference to ssize_t
like the code already does a few lines below.
Rose [Mon, 30 Jan 2023 22:37:09 +0000 (17:37 -0500)]
Fix bounds of description
description is 256. However, buffer is 258, which is a problem because we are possibly exceeding the bounds of description when we access description[2 * i + 2] as i approaches 256. I refactored the code to make it more obvious that this should be avoided.
Zdenek Dohnal [Mon, 30 Jan 2023 08:30:15 +0000 (09:30 +0100)]
Bug report related changes
- adjust bug template to mention CUPS version, an application instead of
browser, precise OS name and version and mention REPORTING_ISSUES
document
- fix a typo in REPORTING_ISSUES document
- mention REPORTING_ISSUES document README
Till Kamppeter [Mon, 30 Jan 2023 02:21:46 +0000 (23:21 -0300)]
Add templates for issue reports
This adds a selection screen when you click the button to report a new
issue on the "Issues" page. The selection screen does not only create
one entry for each issue template but also one extra entry for
security (private) bug reports. The latter is especially important as
otherwise the entrance point for a security bug report is hidden on
the security page.
Till Kamppeter [Sun, 22 Jan 2023 00:28:02 +0000 (21:28 -0300)]
PPD for driverless IPP: Poll "media-col-database" separately if needed
In the create_local_bg_thread() function for auto-generating a PPD
file for a CUPS queue for a driverless printer, either via the
"everywhere" model selection or an auto-created temporary queue we
need to query the full capabilities information from the printer.
To get the full set of printer properties from a driverless IPP
printer one does a "get-printer-attributes" IPP request with the
attribute "requested-attributes" set to "all,media-col-database" (note
that "all" does not include "media-col-database" because this
attribute is often very long, it contains all valid combinations of
media size, media type, media source, and margins). For some printers
this fails and we fall back to just "all" and lose valuable
information.
But some of those printers which do not support "requested-attributes"
set to "all,media-col-database" support "requested-attributes" set to
"media-col-database" alone and this we now make use of, by polling
"media-col-database" separately and adding it to the IPP response of
"all" if needed.
Rose [Fri, 20 Jan 2023 17:34:50 +0000 (12:34 -0500)]
Remove useless depth argument from static function cups_get_printer_uri
This is safe to do since this function is not supposed to be exposed via the ABI, nor is there a pointer to this function, so as long as every other function in the file accommodates this change, no behavioral change should happen.
In addition, depth is always 0 and only used for one debug print statement anyway, so we can and should remove it, instead of simply declaring it unused.