Bug 1284207 - uninitialized variable usage with BN_with_flags
uninitialized variable usage with BN_with_flags
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: openssl (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tomas Mraz
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-21 18:35 EST by Sami Farin
Modified: 2016-07-19 14:31 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-19 14:31:00 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sami Farin 2015-11-21 18:35:28 EST
Description of problem:

/* get a clone of a BIGNUM with changed flags, for *temporary* use only
 * (the two BIGNUMs cannot not be used in parallel!) */
#define BN_with_flags(dest,b,n)  ((dest)->d=(b)->d, \
                                  (dest)->top=(b)->top, \
                                  (dest)->dmax=(b)->dmax, \
                                  (dest)->neg=(b)->neg, \
                                  (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \
                                                 |  ((b)->flags & ~BN_FLG_MALLOCED) \
                                                 |  BN_FLG_STATIC_DATA \
                                                 |  (n)))


BN_with_flags is then called with dest being uninitialized variable.
I didn't read enough of the code to say conclusively is double free() possible with current codebase but I'd remove that "((dest)->flags & BN_FLG_MALLOCED) |" from BN_with_flags to be sure and reduce false alarms from static analyzers.
It also uses BN_FLG_STATIC_DATA , well sure,.. openssl is so obvious 😕

Version-Release number of selected component (if applicable):
1.0.1k-12

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
rt.openssl.org said:
  RT Error
  Queue could not be loaded.
Comment 1 Sami Farin 2015-11-21 19:06:16 EST
Or current users of BN_with_flags could initialize flags before calling it so API stays future-compatible.
Comment 2 Tomas Mraz 2015-11-23 04:43:27 EST
(In reply to Sami Farin from comment #1)
> Or current users of BN_with_flags could initialize flags before calling it
> so API stays future-compatible.

This is the proper fix.

Please report it upstream via mailing to rt@openssl.org
Comment 3 Fedora End Of Life 2016-07-19 14:31:00 EDT
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

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