bug-bash
[Top][All Lists]
Advanced

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

Re: Some segfaults possible via mapfile callbacks


From: Chet Ramey
Subject: Re: Some segfaults possible via mapfile callbacks
Date: Sat, 12 Jan 2013 20:13:07 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/9/13 1:49 PM, Dan Douglas wrote:
> Hi. These were easy for me to reproduce in various versions.
> 
> Export to mapfile the variable to be assigned, then run any callback:
>       $ printf '%s\n' {a..z} | bash -xc 'a= mapfile -tc1 -C : a'
>       + a=
>       + mapfile -tc1 -C : a
>       ++ : 0 a
>       Segmentation fault

Thanks for the report.  This one was easy to fix.  The basic idea is that
mapfile needs to treat its temporary environment the way the eval and
source builtins do, since it uses the internal equivalent of eval to
execute callbacks internally.

> There were others, mostly to do with modifying the variable being mapped.

These all fall into the category of bash letting you shoot yourself, if you
are determined to do so.

Chet
- -- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlDyChoACgkQu1hp8GTqdKtq4wCfYUmZutsjdZ7rdZibbR8QPzv1
mn4An2Inr6XhoZCp9mjQeuBqSAiQuD/+
=Jnhd
-----END PGP SIGNATURE-----



reply via email to

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