bugLaTeX semantic checker - Bugs: bug #34322, chktex detects wrong file names...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #34322: chktex detects wrong file names when following \input commands

Submitter:  - <_85293>
Submitted:  Sat 17 Sep 2011 07:46:32 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  gvol
Open/Closed:  Closed

Wed 28 Mar 2012 02:45:29 PM UTC, comment #5: 

Thank you!

- <_85293>
Tue 27 Mar 2012 07:56:05 PM UTC, comment #4: 

It's fixed in svn so you can try there.  I'm coordinating with baruch on making a new release.

Ivan Andrus <gvol>
Group administrator
Tue 27 Mar 2012 07:43:13 PM UTC, comment #3: 

You're welcome! :)

And, in any case, let me know when the code is fixed. I will download the new version and have a look at it.


- <_85293>
Tue 27 Mar 2012 05:48:57 PM UTC, comment #2: 

This should be fixed, though with a slightly different change than the one you provided.  Thanks for your report.

Ivan Andrus <gvol>
Group administrator
Sat 17 Sep 2011 08:41:15 PM UTC, comment #1: 

The patched code I had previously attached could produce a segfault under certain conditions. This updated patch should fix it.

(file #23986)

- <_85293>
Sat 17 Sep 2011 07:46:32 PM UTC, original submission:  

After upgrading glibc, I found that chktex was unable to follow the names of \input commands, because it misdetected the name between the {} delimiter pair.

For instance, for the sample files main.tex:

\documentclass{article}
\input{part}

and part.tex:

\begin{document}
A \dots B
\end{document}

the output of:

$ chktex main.tex

is:

ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann.

chktex: WARNING -- Unable to open the TeX file `patt'.
Warning 27 in main.tex line 3: Could not execute LaTeX command.
\input{part} 
^^^^^^
No errors printed; One warning printed; No user suppressed warnings printed.


But it should be:

ChkTeX v1.6.4 - Copyright 1995-96 Jens T. Berger Thielemann.

Warning 1 in part.tex line 2: Command terminated with space.
A \dots B 
       ^
No errors printed; One warning printed; No user suppressed warnings printed.


I checked the source code of version 1.6.4 of chktex, and found that on line 221 of file FindErrs.c, the following call is performed:

strcpy(OrigDest, OrigDest + 1);

According to the man page of strcpy(3), the src and dst strings should not overlap, so the results are undefined. When I upgraded glibc to version 2.12.2, the bug actually occurred.


I include a patch which replaces the call for an alternative:

ShiftLeftOne(OrigDest);

defined as

static void ShiftLeftOne(char *Buf)
{
    char *P;

    for (P = Buf + 1; *P; ++P)
      *(P - 1) = *P;
    *(P - 1) = '\0';
}

After recompiling, the bug was solved.

- <_85293>

 

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

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gvol (Posted a comment)
  • -email is unavailable- added by _85293 (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.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-03-27 gvol Summarychktex detects wrong file names when following \\input commands chktex detects wrong file names when following \input commands
    2012-03-27 gvol StatusNone Fixed
        Assigned toNone gvol
        Open/ClosedOpen Closed
        Summarychktex detects wrong file names when following \\input commands chktex detects wrong file names when following \input commands
    2011-09-17 _85293 Attached File- Added chktex-1.6.4-strcpy-bug.patch, #23986
    2011-09-17 _85293 Attached File- Added chktex-1.6.4-strcpy-bug.patch, #23985

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code