Hello Jorrit,

Am Samstag, den 16.08.2014, 00:32 +0200 schrieb Jö Fahlke:
> Am Fri, 15. Aug 2014, 15:17:14 +0200 schrieb Jörg Frings-Fürst:
> > Am Freitag, den 15.08.2014, 11:37 +0200 schrieb Jö Fahlke:
> > > Am Fri, 15. Aug 2014, 01:15:09 +0200 schrieb Jörg Frings-Fürst:
> > > > many thanks for your well-written bug report.
> > > > 
[...]
> 
> I had a look at the patch, and also at the PPD specification[1].  The way I
> read this, the line
> 
> *DefaultColorModel: Grayscale 
> 
> consists of the main keyword "*DefaultColorModel" and the StringValue
> "Grayscale ".  The specification says about StringValues (page 23):
> 
>   • The value is composed of printable 7-bit ASCII byte codes, possibly
>     separated by spaces and tabs into multiple components.  It is terminated
>     by a newline, or by a slash, in the case of a translation string.
> 
And then:
 • There is no escape mechanism for forbidden characters.


> The part "possibly separated by spaces and tabs into multiple components"
> allows some room for interpretation.  But in any case this looks like internal
> structure of the value, so any non-leading whitespace appears to be part of
> the value to me.  Sorry for leading you on the wrong path with my idea about
> stripping whitespace.
> 
> Also, you unconditionally strip trailing whitespace from all lines.  But PPD
> knows some types of values that can span multiple lines, and you probably
> should not strip trailing whitespace in the middle of such values.

That’s right. At all ppd's here I have search for a space or tab at the
end. I don't found any. But it is not forbidden.  So I moved to the end
of the Value reading. So I manipulate every entry only once a time.

 
> 
> And in any case, this is not sufficient.  You could for instance use the
> spelling "Greyscale" by mistake, and you'd still get the segfault, since
> choice is still dereferenced without checking whether it is NULL.  (I checked,
> with your patch.)
> 
I think that this work can only done with the upstream maintainer. 


> By the way, is there a reason you did not reply to the bug report?  Feel free
> to post this mail there, otherwise.
> 
Sorry for this. I was only remote with a tablet online. I think that I
have pressed the wrong menu item.


> Regards,
> Jö.
> 
> [1] http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
> 

CU

Jörg

-- 
pgp Fingerprint: 7D13 3C60 0A10 DBE1 51F8  EBCB 422B 44B0 BE58 1B6E
pgp Key: BE581B6E
CAcert Key S/N: 0E:D4:56

Jörg Frings-Fürst
D-54526 Niederkail

Threema: SYR8SJXB

IRC: [email protected]
     [email protected]





Description: remove trailing whitespaces from ppd files
 Remove trailing whitespaces from ppd file to prevent segfault
Author: Jörg Frings-Fürst <[email protected]>
Origin: <upstream|backport|vendor|other>, <URL, required except if Author is present>
Bug: <URL to the upstream bug report if any, implies patch has been forwarded, optional>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758133
Forwarded: <URL|no|not-needed, useless if you have a Bug field, optional>
Applied-Upstream: <version|URL|commit, identifies patches merged upstream, optional>
Reviewed-by: <name and email of a reviewer, optional>
Last-Update: 2014-08-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: trunk/options.c
===================================================================
--- trunk.orig/options.c	2014-08-17 09:56:36.990949026 +0200
+++ trunk/options.c	2014-08-17 09:59:43.750779956 +0200
@@ -1628,6 +1628,10 @@
         /* remove last newline */
         dstrremovenewline(value);
 
+        /* remove last whitespace */
+        /* new 2014-08-17         */
+        dstrtrim_right(value);
+
         /* process key/value pairs */
         if (strcmp(key, "NickName") == 0) {
             unhtmlify(printer_model, 256, value->data);

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to