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

Submitted by:  Edgar <ausiaso>
Submitted on:  Sat 17 Sep 2011 07:46:32 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Ivan Andrus <gvol>
Open/Closed: Closed

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

Thank you!

Edgar <ausiaso>
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>
Project AdministratorIn charge of this item.
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.

Edgar <ausiaso>
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>
Project AdministratorIn charge of this item.
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)

Edgar <ausiaso>
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.

Edgar <ausiaso>

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gvol (Posted a comment)
  • -unavailable- added by ausiaso (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 27 Mar 2012 07:56:05 PM UTCgvolSummarychktex detects wrong file names when following \\input commands=>chktex detects wrong file names when following \input commands
    Tue 27 Mar 2012 05:48:57 PM UTCgvolStatusNone=>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
    Sat 17 Sep 2011 08:41:15 PM UTCausiasoAttached File-=>Added chktex-1.6.4-strcpy-bug.patch, #23986
    Sat 17 Sep 2011 07:46:32 PM UTCausiasoAttached File-=>Added chktex-1.6.4-strcpy-bug.patch, #23985

    Back to the top


    Powered by Savane 3.1-cleanup1