emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#22181: closed (endless loop in grep 2.22)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#22181: closed (endless loop in grep 2.22)
Date: Sat, 19 Dec 2015 06:25:01 +0000

Your message dated Fri, 18 Dec 2015 22:24:14 -0800
with message-id <address@hidden>
and subject line Re: bug#22181: endless loop in grep 2.22
has caused the debbugs.gnu.org bug report #22181,
regarding endless loop in grep 2.22
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
22181: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22181
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: endless loop in grep 2.22 Date: Tue, 15 Dec 2015 21:20:44 +0100 User-agent: KMail/4.14.10 (Linux/4.3.0-2-default; KDE/4.14.14; x86_64; ; )
Hello,

I hit an endless loop in grep 2.22. I can reproduce it with

# grep -obUa -P '\x04\x08\x00profile\x00\x07' cache--usr.sbin.smbldap-useradd  
16profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
27801profile
[...]

I get this line over and over (some minutes long) - but for testing,
you might want to use   ... | head -n50   to avoid heating your office
using your computer ;-)

The file needed for the reproducer is attached. 
To make sure you have an unmodified copy - its sha256sum is
89f458796dcb1cdcaec534fec84c6c3440844dbd6dc014e51a5d74e9800c2aab

I have more files that can reproduce the endless loop - basically it
looks like lots of (or all?) AppArmor cache files of profiles that 
contain subprofiles or hats trigger this. OTOH, cache files from single
profiles don't trigger the endless loop.

As the subject says, I'm using grep 2.22 on openSUSE Tumbleweed.

This bug seems to be a regression. I wasn't able to reproduce this bug
with grep 2.14, and sarnold on #apparmor also couldn't reproduce it with
grep 2.21 on Ubuntu. OTOH, he could reproduce the endless loop with 
grep 2.22 on Ubuntu.

I also downloaded and compiled the grep 2.21 and 2.22 tarballs.
Result (not too surprising):
- 2.21 works as expected
- 2.22 enters an endless loop

-> This is clearly a regression between 2.21 and 2.22.


For comparison: The expected output (with grep 2.21) is:

#2.21# ./grep -obUa -P '\x04\x08\x00profile\x00\x07' 
cache--usr.sbin.smbldap-useradd 
16profile
27801profile


Regards,

Christian Boltz

PS: usually I use a random signature, but I'll use a hand-picked quote
    for this mail ;-)
-- 
<sarnold> I don't know how cboltz survives, everything he touches
breaks into several pieces .. I fear for his car.. [from #apparmor]

Attachment: cache--usr.sbin.smbldap-useradd
Description: Binary data


--- End Message ---
--- Begin Message --- Subject: Re: bug#22181: endless loop in grep 2.22 Date: Fri, 18 Dec 2015 22:24:14 -0800
On Fri, Dec 18, 2015 at 1:50 PM, Paul Eggert <address@hidden> wrote:
> On 12/18/2015 12:52 PM, Jim Meyering wrote:
>>
>> And here is the patch that will form the basis of a complete fix:
>
> Thanks for looking into that; you beat me to it!
>
> POSIX says grep has undefined behavior when given an encoding error, and
> looping forever sure fills the bill :-).

:-)

Here is the patch I expect to push tomorrow. I am using
the occasion of this reply to close the bug report by inserting
"-done" in the bug email address. Any reply will still go both to
the mailing list and to the bug-tracking system.

Attachment: 0001-grep-oP-don-t-infloop-when-processing-invalid-UTF8-p.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]