Last Comment Bug 659748 - jump bypasses variable initialization
: jump bypasses variable initialization
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Security: PSM (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla7
Assigned To: Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-25 13:48 PDT by Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
Modified: 2011-05-28 05:49 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
move the variable definition (954 bytes, patch)
2011-05-25 13:48 PDT, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
kaie: review-
Details | Diff | Review
updated patch (1.50 KB, patch)
2011-05-27 07:59 PDT, Rafael Ávila de Espíndola (:espindola) (not reading bugmail)
kaie: review+
Details | Diff | Review

Description Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-05-25 13:48:38 PDT
Created attachment 535172 [details] [diff] [review]
move the variable definition

nsNSSCertificateDB.cpp now fails to compile with clang because a goto jumps over

CERTValOutParam cvout[1];
Comment 1 Kai Engert (:kaie) 2011-05-27 07:41:12 PDT
Comment on attachment 535172 [details] [diff] [review]
move the variable definition

>diff --git a/security/manager/ssl/src/nsNSSCertificateDB.cpp b/security/manager/ssl/src/nsNSSCertificateDB.cpp
>index dada28d..cb49fed 100644
>--- a/security/manager/ssl/src/nsNSSCertificateDB.cpp
>+++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp
>@@ -562,6 +562,10 @@ nsNSSCertificateDB::ImportEmailCertificate(PRUint8 * data, PRUint32 length,
> 
>   numcerts = certCollection->numcerts;
> 
>+  // Note: This has to be defined before the first "goto loser", otherwise clang
>+  // will error saying: "jump bypasses variable initialization".

Comment not necessary


>+  CERTValOutParam cvout[1];

Please move this further up. Please move it to the section where all variables are declared, after the "int i".


>-  CERTValOutParam cvout[1];
>   cvout[0].type = cert_po_end;

Please move both lines.

Could you please make these changes?
Comment 2 Rafael Ávila de Espíndola (:espindola) (not reading bugmail) 2011-05-27 07:59:25 PDT
Created attachment 535637 [details] [diff] [review]
updated patch
Comment 3 Kai Engert (:kaie) 2011-05-27 08:18:08 PDT
Comment on attachment 535637 [details] [diff] [review]
updated patch

Review of attachment 535637 [details] [diff] [review]:
-----------------------------------------------------------------

r=kaie

Thanks
Comment 4 Dão Gottwald [:dao] 2011-05-28 05:49:53 PDT
http://hg.mozilla.org/mozilla-central/rev/7fb970049952

Note You need to log in before you can comment on or make changes to this bug.