[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen
From: |
Bruce Korb |
Subject: |
Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen |
Date: |
Sat, 23 May 2015 08:35:26 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 05/22/15 08:45, Filipe Brandenburger wrote:
On Fri, May 22, 2015 at 8:32 AM, Bruce Korb <address@hidden> wrote:
And, yes, the patch included a non-related issue. Someone came up
with a tortured uu-encoded file that would cause uudecode to seg fault.
Would be nice to add a test case for it... Is the uu-encoded file that
caused the crash available somewhere public? Or would it be easy to
create a simple test case with the same kind of problem?
It was in an email that got to me somehow:
$ od -c stackoverflow.uu
0000000 b e g i n 0 ~
0000007
$ uudecode stackoverflow.uu
uudecode fatal error:
stackoverflow.uu: Invalid or missing 'begin' line
Reading through the various docs I found lots of weasel words saying
decode is not robust against pathological inputs. Still, the above
is now fixed:
http://autogen.sourceforge.net/data/sharutils-4.15.1.4-ed86.tar.xz
but that is not to say you couldn't cook up another. It's a bit harder now.
There is also a bit more to play with. POSIX currently defines two "begin"
lines:
begin-base64 <mode> <decoded-path-name>
begin <mode> <decoded-path-name>
In order to allow arbitrarily international "decoded path name"s, the
current code (as a POSIX extension) added another "-encoded" option
to the begin. It may appear by itself, or also before or after the "-base64",
yielding 5 variations on "begin":
begin-encoded <mode> <encoded-decoded-path-name>
begin-base64-encoded <mode> <encoded-decoded-path-name>
begin-encoded-base64 <mode> <encoded-decoded-path-name>
with the last two being effectively the same. The "encoded-decoded-
path-name" is base64 encoded. So continuing the above example:
$ f=stackoverflow.uu ; uuencode -m -e $f < $f
begin-base64-encoded 644 c3RhY2tvdmVyZmxvdy51dQ==
YmVnaW4wfg==
====
the last three lines could be reconstructed into the problematical file.
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, (continued)
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Filipe Brandenburger, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Eli Zaretskii, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Andreas Schwab, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Bruce Korb, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Filipe Brandenburger, 2015/05/22
- [PATCH 1/2] Use O_BINARY to detect whether to pass "rb" to popen, Filipe Brandenburger, 2015/05/22
- [PATCH 2/2] Be more careful in guarding against pathological "begin" lines, Filipe Brandenburger, 2015/05/22
- Re: [PATCH 1/2] Use O_BINARY to detect whether to pass "rb" to popen, cowan, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Bruce Korb, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Filipe Brandenburger, 2015/05/22
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen,
Bruce Korb <=
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Filipe Brandenburger, 2015/05/29
- Re: [PATCH] Use O_BINARY to detect whether to pass "rb" to popen, Bruce Korb, 2015/05/29
- Re: [PATCH 0/4] Cross compiling sharutils, Eric Blake, 2015/05/21
- Re: [PATCH 0/4] Cross compiling sharutils, Eli Zaretskii, 2015/05/21
- Re: [PATCH 0/4] Cross compiling sharutils, Filipe Brandenburger, 2015/05/22
- Re: [PATCH 0/4] Cross compiling sharutils, Eli Zaretskii, 2015/05/22
- Re: [PATCH 0/4] Cross compiling sharutils, Eric Blake, 2015/05/22
- Re: [PATCH 0/4] Cross compiling sharutils, Eli Zaretskii, 2015/05/21
- Re: [PATCH 0/4] Cross compiling sharutils, Eli Zaretskii, 2015/05/21