develooper Front page | perl.perl5.porters | Postings from April 2013

[perl #117539] Fix incorrect assumptions about gids & uids

Thread Previous | Thread Next
From:
Brian Fraser via RT
Date:
April 9, 2013 02:55
Subject:
[perl #117539] Fix incorrect assumptions about gids & uids
Message ID:
rt-3.6.HEAD-28177-1365476138-636.117539-15-0@perl.org
On Mon Apr 08 16:36:35 2013, Hugmeir wrote:
> This is a bug report for perl from fraserb@gmail.com,
> generated with the help of perlbug 1.39 running under perl 5.16.2.
> 
> 
> -----------------------------------------------------------------
> [Please describe your issue here]
> 
> See the attached patch. Copypasting the commit message here:
> 
>     Stop making assumptions about uids and gids.
> 
>     The code dealt rather inconsistently with uids and gids. Some
>     places assumed that they could be safely stored in UVs, others
>     in IVs, others in ints; All of them should've been using the
>     macros from config.h instead. Similarly, code that created
>     SVs or pushed values into the stack was also making incorrect
>     assumptions -- For point of reference, only pp_stat did the
>     right thing:
> 
>      #if Uid_t_size > IVSIZE
>         mPUSHn(PL_statcache.st_uid);
>      #else
>      #   if Uid_t_sign <= 0
>         mPUSHi(PL_statcache.st_uid);
>      #   else
>         mPUSHu(PL_statcache.st_uid);
>      #   endif
>      #endif
> 
>     The other places were potential bugs, and some were even causing
>     warnings in some unusual OSs, like haiku or qnx.
> 
>     This commit ammends the situation by using the [GU]id_t macros
>     defined in config.h, and using the above paradigm when creating
>     SVs from the values returned by PerlProc_getuid and friends.
> 

Minor correction. The commit messages says "like haiku or qnx", but I
was mistaken; Haiku is not affected. To make up for that data point,
syllable, which we don't support (yet?), is affected:

[vagrant@syllable:~/perl-8df2720]make perl
`sh  cflags "optimize='-O'" perlmini.o`  -DPERL_IS_MINIPERL
-DPERL_EXTERNAL_GLOB perlmini.c
	  CCCMD =  cc -DPERL_CORE -c -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include  -std=c89 -O -Wall -ansi -W
-Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat
-Wwrite-strings 
perl.c: In function 'S_validate_suid':
perl.c:3794: warning: comparison between signed and unsigned
perl.c:3796: warning: comparison between signed and unsigned

--hugmeir


---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=117539

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About