Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cupstestppd segfaults on some PPDs #1864

Closed
michaelrsweet opened this issue Jul 25, 2006 · 3 comments
Closed

cupstestppd segfaults on some PPDs #1864

michaelrsweet opened this issue Jul 25, 2006 · 3 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2.2
CUPS.org User: kssingvo.suse

There is a problem in cupstestppd, which causes segfaults. But we noticed this problem only on AMD64 and only rarely (a lot of tests are usually necessary).

The problem is that the late call of "check_basics(argv[i])", which uses "i". But "i" is used for a different counting there.

I'm going to attache a proposal for a patch.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"cups-1.2.2-cupstestppd_filename.patch":

--- cups-1.2.2/systemv/cupstestppd.c.orig 2006-07-25 18:43:43.000000000 +0200
+++ cups-1.2.2/systemv/cupstestppd.c 2006-07-25 19:09:20.000000000 +0200
@@ -90,6 +90,7 @@
int i, j, k, m, n; /* Looping vars /
int len; /
Length of option name /
char *opt; /
Option character */

  • char ppdfilename; / Pointer to actual PPD file /
    const char *ptr; /
    Pointer into string /
    int files; /
    Number of files /
    int verbose; /
    Want verbose output? */
    @@ -293,6 +294,7 @@

    errors = 0;
    ppdversion = 43;

  •  ppdfilename = argv[i];
    

    if (verbose > 0)
    _cupsLangPuts(stdout,
    @@ -1204,7 +1206,7 @@

    if (verbose >= 0)
    {

  •    check_basics(argv[i]);
    
  •    check_basics(ppdfilename);
    
    /*
    
    • Look for default keywords with no corresponding option...

@michaelrsweet
Copy link
Collaborator Author

"str1864.patch":

Index: cupstestppd.c

--- cupstestppd.c (revision 5771)
+++ cupstestppd.c (working copy)
@@ -306,9 +306,9 @@
* Look for default keywords with no matching option...
*/

  •  for (i = 0; i < ppd->num_attrs; i ++)
    
  •  for (j = 0; j < ppd->num_attrs; j ++)
    
    {
  • attr = ppd->attrs[i];
  • attr = ppd->attrs[j];
 if (!strcmp(attr->name, "DefaultColorSpace") ||
!strcmp(attr->name, "DefaultFont") ||

@@ -327,11 +327,11 @@
* Check that the default option value matches a choice...
*/

  •   for (j = 0; j < option->num_choices; j ++)
    
  •     if (!strcmp(option->choices[j].choice, attr->value))
    
  •   for (k = 0; k < option->num_choices; k ++)
    
  •     if (!strcmp(option->choices[k].choice, attr->value))
        break;
    
  •        if (j >= option->num_choices)
    
  •        if (k >= option->num_choices)
    {
      if (verbose >= 0)
      {
    

    @@ -1205,9 +1205,9 @@

    • Look for default keywords with no corresponding option...
      */
  • for (i = 0; i < ppd->num_attrs; i ++)

  • for (j = 0; j < ppd->num_attrs; j ++)
    {

  • attr = ppd->attrs[i];
    
  • attr = ppd->attrs[j];
    
       if (!strcmp(attr->name, "DefaultColorSpace") ||
      !strcmp(attr->name, "DefaultColorSep") ||
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant