bugGNU Enscript - Bugs: bug #31012, enscript seg faults while...

 
 

bug #31012: enscript seg faults while processing the config file

Submitter:  Bruce Korb <bkorb>
Submitted:  Fri 10 Sep 2010 11:09:44 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 10 Jul 2011 01:26:45 AM UTC, comment #4: 

I have opened bug #33738 to keep track of the fact that Enscript should never break --help and --version.  Unfortunately, I think main.c needs some quite extensive refactoring to make this happen.

(Closing this bug.)

Tim Retout <diocles>
Group Member
Wed 15 Sep 2010 08:52:50 PM UTC, comment #3: 

1.6.5.2 fixes this issue.  However, you probably should
process --help and --version args before processing
config files, and perhaps describe what's wrong with
the config file when you do process it.  I did, after all,
read the man page when constructing the file.  I read this:

       All other lines are option lines and have format:
       option [arguments ...].
       The following options can be specified:
       AcceptCompositeCharacters: bool
               Specify whether PostScript font's composite characters are
               accepted  as  printable or if they should be considered as
               non-existent.  The default value is false (0).

and interpreted it to mean putting the colon after the name
as a value separator.  The parser ought to tolerate a colon,
an equal sign or just white space as the name/value separator.

$ enscript --help
enscript:/vmem/bkorb/.enscriptrc:2: missing argument: Media:
$ enscript --version
enscript:/vmem/bkorb/.enscriptrc:2: missing argument: Media:
$ rm -f ~/.enscriptrc ; enscript --version
GNU Enscript 1.6.5.2 [...]

Bruce Korb <bkorb>
Wed 15 Sep 2010 09:21:11 AM UTC, comment #2: 

Hi Bruce,

Is it possible for you to check whether this still occurs in enscript 1.6.5.2? This release fixed a segmentation fault when throwing errors in config files, which sounds a lot like the problem you are describing.

Thanks,

Tim

Tim Retout <diocles>
Group Member
Fri 10 Sep 2010 11:15:57 PM UTC, comment #1: 

Sorry, wrong listing:

(gdb) list
251               token2 = GET_TOKEN (NULL);
252               CHECK_TOKEN ();
253               name = token2;
254
255               token2 = GET_TOKEN (NULL);
256               CHECK_TOKEN (); <<<====
257               w = atoi (token2);
258
259               token2 = GET_TOKEN (NULL);
260               CHECK_TOKEN ();

enscript-1.6.5, by the way.

Bruce Korb <bkorb>
Fri 10 Sep 2010 11:09:44 PM UTC, original submission:  

Even if the config file contains invalid text, it should
not fault:

Program received signal SIGSEGV, Segmentation fault.
0x00000037330797c0 in strlen () from /lib64/libc.so.6
(gdb) bt
#0  0x00000037330797c0 in strlen () from /lib64/libc.so.6
#1  0x0000003733046b69 in vfprintf () from /lib64/libc.so.6
#2  0x0000003733047f36 in buffered_vfprintf () from /lib64/libc.so.6
#3  0x0000003733042a1c in vfprintf () from /lib64/libc.so.6
#4  0x000000373304d358 in fprintf () from /lib64/libc.so.6
#5  0x000000000040fa2b in read_config (path=0x7fffe6819d38 "/vmem/bkorb",
   file=0x41c7c8 ".enscriptrc") at ../../src/util.c:256
#6  0x00000000004026f4 in main (argc=2, argv=0x7fffe68189a8)
   at ../../src/main.c:1133
(gdb) f 5
#5  0x000000000040fa2b in read_config (path=0x7fffe6819d38 "/vmem/bkorb",
   file=0x41c7c8 ".enscriptrc") at ../../src/util.c:256
256               CHECK_TOKEN ();
(gdb) list
406               ul_angle_p = 1;
407             }
408           else if (MATCH (token, "UnderlayFont:"))
409             {
410               token2 = GET_TOKEN (NULL);
411               CHECK_TOKEN ();
412               if (!parse_font_spec (token2, &ul_font, &ul_ptsize, NULL))
413                 CFG_FATAL ((stderr, _("malformed font spec: %s"), token2));
414             }
415           else if (MATCH (token, "UnderlayGray:"))
$ cat ~/.enscriptrc
Printer: hp8000-duplex
Media: letter

Bruce Korb <bkorb>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by diocles (Posted a comment)
  • -email is unavailable- added by bkorb (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-07-10 diocles StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code