bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] vasnprintf: Don't use %n on android


From: Hugo Beauzée-Luyssen
Subject: Re: [PATCH] vasnprintf: Don't use %n on android
Date: Mon, 21 Jan 2019 17:51:12 +0100

On Mon, Jan 21, 2019, at 5:11 PM, Tim Rühsen wrote:
> On 1/21/19 5:00 PM, Hugo Beauzée-Luyssen wrote:
> > On Mon, Jan 21, 2019, at 4:58 PM, Tim Rühsen wrote:
> >> On 1/8/19 2:22 PM, Hugo Beauzée-Luyssen wrote:
> >>> On Thu, Dec 20, 2018, at 2:53 AM, Bruno Haible wrote:
> >>>> Hi,
> >>>>
> >>>> Hugo Beauzée-Luyssen wrote:
> >>>>> 12-14 19:10:02.633 F DEBUG   : pid: 31664, tid: 32389, name: VlcObject  
> >>>>> >>> org.videolan.vlc <<<
> >>>>> 12-14 19:10:02.633 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), 
> >>>>> fault addr --------
> >>>>> 12-14 19:10:02.633 F DEBUG   : Abort message: 'FORTIFY: %n not allowed 
> >>>>> on Android'
> >>>>
> >>>> Indeed, %n in *printf is not allowed on Android, see
> >>>> https://android.googlesource.com/platform/bionic/+/master/libc/stdio/vfprintf.cpp
> >>>> https://android.googlesource.com/platform/bionic/+/master/docs/status.md
> >>>>
> >>>>> diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
> >>>>> index af3fcd1c7..e41d5f706 100644
> >>>>> --- a/lib/vasnprintf.c
> >>>>> +++ b/lib/vasnprintf.c
> >>>>> @@ -4874,7 +4874,8 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
> >>>>>  # if ! (((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))   
> >>>>>      \
> >>>>>           && !defined __UCLIBC__)                                       
> >>>>>      \
> >>>>>          || (defined __APPLE__ && defined __MACH__)                     
> >>>>>      \
> >>>>> -        || (defined _WIN32 && ! defined __CYGWIN__))
> >>>>> +        || (defined _WIN32 && ! defined __CYGWIN__)                    
> >>>>>      \
> >>>>> +        || defined __ANDROID__)
> >>>>>                  fbp[1] = '%';
> >>>>>                  fbp[2] = 'n';
> >>>>>                  fbp[3] = '\0';
> >>>>
> >>>> The patch looks good at first sight. But when you look at the comments a
> >>>> couple of lines before it, you see that one can avoid %n only
> >>>> if snprintf behaves well enough. To this effect, can you please report
> >>>> the configure results (from a *native* Android compilation, not a cross-
> >>>> compilation) of these tests:
> >>>>
> >>>> 1 = checking whether printf supports size specifiers as in C99...
> >>>> 2 = checking whether printf supports 'long double' arguments...
> >>>> 3 = checking whether printf supports infinite 'double' arguments...
> >>>> 4 = checking whether printf supports infinite 'long double' arguments...
> >>>> 5 = checking whether printf supports the 'a' and 'A' directives...
> >>>> 6 = checking whether printf supports the 'F' directive...
> >>>> 7 = checking whether printf supports the 'n' directive...
> >>>> 8 = checking whether printf supports the 'ls' directive...
> >>>> 9 = checking whether printf supports POSIX/XSI format strings with 
> >>>> positions...
> >>>> 10 = checking whether printf supports the grouping flag...
> >>>> 11 = checking whether printf supports the left-adjust flag correctly...
> >>>> 12 = checking whether printf supports the zero flag correctly...
> >>>> 13 = checking whether printf supports large precisions...
> >>>> 14 = checking whether printf survives out-of-memory conditions...
> >>>> 15 = checking for snprintf...
> >>>> 16 = checking whether snprintf truncates the result as in C99...
> >>>> 17 = checking whether snprintf returns a byte count as in C99...
> >>>> 18 = checking whether snprintf fully supports the 'n' directive...
> >>>> 19 = checking whether snprintf respects a size of 1...
> >>>> 20 = checking whether vsnprintf respects a zero size as in C99...
> >>>>
> >>>> You should find these in the configure output of any package that
> >>>> uses gnulib's 'vasnprintf' module. If you don't have one at hand,
> >>>> create one using
> >>>>   ./gnulib-tool --create-testdir --dir=testdir --single-configure 
> >>>> vasnprintf
> >>>>
> >>>> Thanks.
> >>>>
> >>>> Bruno
> >>>>
> >>>
> >>> Hi,
> >>>
> >>> I'm probably missing something, but for me this only seems to test for 
> >>> snprintf/printf/vasnprintf availability (including running configure in 
> >>> the generated test directory)
> >>
> >> I would really like to see the patch in gnulib as soon as possible.
> >>
> >> @hugo If it's not too much hassle, could you please provide the
> >> requested information ?
> >>
> >> Regards, Tim
> >>
> > 
> > Hi,
> > 
> > I'd love to, but I failed to fetch those so far. The provided command line 
> > didn't return any valuable information, and simply tested for the presence 
> > of various printf family function.
> > 
> > Regards,
> 
> So you cd'ed into testdir and run `./configure` !?
> 

Yes

> I also don't see much here (Debian unstable):
> 
> $ grep -A1 -i 'checking.*printf' config.log
> configure:6305: checking for vasnprintf
> configure:6305: result: no
> configure:6305: checking for snprintf
> configure:6305: result: yes
> --
> configure:8450: checking whether snprintf returns a byte count as in C99
> configure:8548: result: yes
> configure:8559: checking for snprintf
> configure:8559: result: yes
> --
> configure:8568: checking whether _snprintf is declared
> configure:8568: result: no
> 
> What does that grep look for you ?

$ grep -A1 'checking .*printf' config.log
configure:6326: checking for vasnprintf
configure:6326: gcc -o conftest -g -O2   conftest.c  >&5
--
configure:6326: checking for snprintf
configure:6326: gcc -o conftest -g -O2   conftest.c  >&5
--
configure:8471: checking whether snprintf returns a byte count as in C99
configure:8558: gcc -o conftest -g -O2   conftest.c  >&5
--
configure:8580: checking for snprintf
configure:8580: result: yes
--
configure:8589: checking whether _snprintf is declared
configure:8589: gcc -c -g -O2  conftest.c >&5


FWIW, I ran the test using termux on a chromebook, since that's the only way I 
know of doing a native android compile (beside cross compiling an android 
compiler, but I'd like to avoid having doing that if possible) 

> 
> @Bruno Is there something missing ?
> 
> Regards, Tim
> 
> Email had 1 attachment:
> + signature.asc
>   1k (application/pgp-signature)


-- 
  Hugo Beauzée-Luyssen
  address@hidden



reply via email to

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