Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sign extension issue found by Coverity #21

Closed
jhi opened this issue Apr 29, 2014 · 1 comment
Closed

sign extension issue found by Coverity #21

jhi opened this issue Apr 29, 2014 · 1 comment

Comments

@jhi
Copy link

jhi commented Apr 29, 2014

I have been checking perl5 with Coverity and it found a medium-level issue from Encode, a spot where an unintended sign extension might happen:

--- a/cpan/Encode/Unicode/Unicode.xs
+++ b/cpan/Encode/Unicode/Unicode.xs
@@ -80,7 +80,7 @@ enc_unpack(pTHX_ U8 *_sp, U8 *e, STRLEN size, U8 endian)
if (endian == 'v')
break;
v |= (_s++ << 16);

  •   v |= (*s++ << 24);  
    
  •   v |= ((UV)*s++ << 24);  
    break;  
    
    default:
    croak("Unknown endian %c",(char) endian);
@dankogai
Copy link
Owner

Thanks. Fixed in 138d4a9

jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jul 16, 2014
2.62 2014/05/31 12:12:39
! Encode.pm
  s/2013/2014/ on COPYRIGHT section
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode/Makefile_PL.e2x
  Encode.xs
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  Merged from perl.git: "Fix Encode 2.60 with g++"
  http://perl5.git.perl.org/perl.git/commit/89c2544cd3

2.61 2014/05/31 09:48:48
! bin/piconv
  Applied: piconv nit
  + Better error handling when the encoding name is nonexistent
  Message-Id: <537139A0.1000503@iki.fi>
! Encode.xs
  Applied: RT #95466:
   fallback definition of SvIsCOW() is wrong
   (and hence breaks on 5.8.2 and earlier)
  https://rt.cpan.org/Ticket/Display.html?id=95466

2.60 2014/04/29 16:25:06
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode/Makefile_PL.e2x
  Encode/encode.h
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  encengine.c
  Applied: more Fix Windows build (of Encode) with VC++ 6.0
  http://perl5.git.perl.org/perl.git/commit/9e9002efd1609c7d154f98af43a026320df7582c
! Unicode/Unicode.xs
  Addressed: sign extension issue found by Coverity #21
  dankogai/p5-encode#21
! Encode/encode.h Encode.xs Unicode/Unicode.xs
  removed #define U8 U8
  https://rt.perl.org/Ticket/Display.html?id=121554
  http://perl5.git.perl.org/perl.git/commit/2f2b4ff2c154a8e461857f2e82cb815c238d0d94

2.59 2014/04/06 17:23:55
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode.pm
  Encode.xs
  Encode/Makefile_PL.e2x
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  Restored the signature of Encode_XSEncoding() to address RT#94478
  * While dankogai/p5-encode#20
    pulls the symnames via argument thus breaks the compatibility
    with Encode::XX modules with *.ucm, the restored version
    pulls the symanmes via enc->name[0] so the added 2nd argument
    is no longer needed.
  https://rt.cpan.org/Public/Bug/Display.html?id=94478

2.58 2014/03/28 02:37:42
! bin/piconv
  Addressed: piconv bug of decoding UTF-16 (with fix)
  dankogai/p5-encode#19
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode.pm
  Encode.xs
  Encode/Makefile_PL.e2x
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  Pulled: Remap symname [RT #94221]
  dankogai/p5-encode#20
  https://rt.cpan.org/Public/Bug/Display.html?id=94221
! Encode.pm
  Pulled: [doc] clarify that CHECK coderefs return octets #18
  dankogai/p5-encode#18
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Oct 11, 2014
2.62 2014/05/31 12:12:39
! Encode.pm
  s/2013/2014/ on COPYRIGHT section
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode/Makefile_PL.e2x
  Encode.xs
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  Merged from perl.git: "Fix Encode 2.60 with g++"
  http://perl5.git.perl.org/perl.git/commit/89c2544cd3

2.61 2014/05/31 09:48:48
! bin/piconv
  Applied: piconv nit
  + Better error handling when the encoding name is nonexistent
  Message-Id: <537139A0.1000503@iki.fi>
! Encode.xs
  Applied: RT #95466:
   fallback definition of SvIsCOW() is wrong
   (and hence breaks on 5.8.2 and earlier)
  https://rt.cpan.org/Ticket/Display.html?id=95466

2.60 2014/04/29 16:25:06
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode/Makefile_PL.e2x
  Encode/encode.h
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  encengine.c
  Applied: more Fix Windows build (of Encode) with VC++ 6.0
  http://perl5.git.perl.org/perl.git/commit/9e9002efd1609c7d154f98af43a026320df7582c
! Unicode/Unicode.xs
  Addressed: sign extension issue found by Coverity #21
  dankogai/p5-encode#21
! Encode/encode.h Encode.xs Unicode/Unicode.xs
  removed #define U8 U8
  https://rt.perl.org/Ticket/Display.html?id=121554
  http://perl5.git.perl.org/perl.git/commit/2f2b4ff2c154a8e461857f2e82cb815c238d0d94

2.59 2014/04/06 17:23:55
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode.pm
  Encode.xs
  Encode/Makefile_PL.e2x
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  Restored the signature of Encode_XSEncoding() to address RT#94478
  * While dankogai/p5-encode#20
    pulls the symnames via argument thus breaks the compatibility
    with Encode::XX modules with *.ucm, the restored version
    pulls the symanmes via enc->name[0] so the added 2nd argument
    is no longer needed.
  https://rt.cpan.org/Public/Bug/Display.html?id=94478

2.58 2014/03/28 02:37:42
! bin/piconv
  Addressed: piconv bug of decoding UTF-16 (with fix)
  dankogai/p5-encode#19
! Byte/Makefile.PL
  CN/Makefile.PL
  EBCDIC/Makefile.PL
  Encode.pm
  Encode.xs
  Encode/Makefile_PL.e2x
  JP/Makefile.PL
  KR/Makefile.PL
  Symbol/Makefile.PL
  TW/Makefile.PL
  bin/enc2xs
  Pulled: Remap symname [RT #94221]
  dankogai/p5-encode#20
  https://rt.cpan.org/Public/Bug/Display.html?id=94221
! Encode.pm
  Pulled: [doc] clarify that CHECK coderefs return octets #18
  dankogai/p5-encode#18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants