[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openssl-users
Subject:    RE: Error while encryption or Decrypting
From:       Mouse <urimobile () optonline ! net>
Date:       2007-07-30 12:37:18
Message-ID: 021801c7d2a6$5e414b50$5f01a8c0 () morannon
[Download RAW message or body]

That line means "if benc still points at something, free it".  The problem
is - more likely than not, somebody has already freed benc, but did not set
benc to zero (or NULL). As a result, this check (line 640) says "benc is not
zero, so it must be pointing at something that must be freed, so invoke the
free()".
 
Trace the use of benc and make sure whoever freed it before line 640, also
set it to zero.
 
Better way of freeing in the context would be:
 
    if (benc != NULL) {
        if (BIO_free(benc) == 0) 
            abort_with_error("Cannot free benc!");
        benc = 0; 
    }
 
where abort_with_error() is your own function.


  _____  

From: owner-openssl-users@openssl.org
[mailto:owner-openssl-users@openssl.org] On Behalf Of Pink Princess
Sent: Monday, July 30, 2007 06:50
To: Brad Hards
Cc: openssl-users@openssl.org
Subject: Re: Error while encryption or Decrypting


Dear brad

 Thanks for the advice and the hint


I have been through the free commands to check where the error occured


In APPS folder in enc.c file

whenever I comment this line(640)  
    if (benc != NULL) BIO_free(benc); 
the dump core disappear


I am working in check what does this line mean and what is benc 


regards




On 7/29/07, Brad Hards <bradh@frogmouth.net> wrote: 

On Saturday 28 July 2007 01:49, Pink Princess wrote:
> *** glibc detected *** /home/noura/workspace/256OpenSSL/apps/openssl:
> double free or corruption (!prev): 0x0820d170 ***
This is the most likely problem - you are free()ing memory that has already 
been free()d. Maybe you are free()ing memory that openssl is cleaning up
later.

Try running under valgrind or a debugger.

Brad





[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=093101612-30072007><FONT face=Arial color=#0000ff>That line 
means "if <EM>benc</EM> still points at something, free it".&nbsp; The problem 
is - more likely than not, somebody has already freed <EM>benc</EM>, but did not 
set <EM>benc</EM> to zero (or NULL). As a result, this check (line 640) says 
"<EM>benc</EM> is not zero, so it must be pointing at something that must be 
freed, so invoke the <EM>free</EM>()".</FONT></SPAN></DIV>
<DIV><SPAN class=093101612-30072007><FONT face=Arial 
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093101612-30072007><FONT face=Arial color=#0000ff>Trace the use 
of <EM>benc</EM> and make sure whoever freed it before line 640, also set it to 
zero.</FONT></SPAN></DIV>
<DIV><SPAN class=093101612-30072007><FONT face=Arial 
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093101612-30072007><FONT face=Arial color=#0000ff>Better way 
of&nbsp;freeing in the context would be:</FONT></SPAN></DIV>
<DIV><SPAN class=093101612-30072007><FONT face=Arial 
color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093101612-30072007>&nbsp;&nbsp;&nbsp; <STRONG><EM><FONT 
face=Arial color=#0000ff>if (benc != NULL) {</FONT></EM></STRONG></SPAN></DIV>
<DIV><SPAN class=093101612-30072007>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<STRONG><EM><FONT face=Arial color=#0000ff>if (BIO_free(benc) == 0) 
</FONT></EM></STRONG></SPAN></DIV>
<DIV><SPAN class=093101612-30072007><STRONG><EM><FONT face=Arial 
color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
abort_with_error("Cannot free benc!");</FONT></EM></STRONG></SPAN></DIV>
<DIV><SPAN class=093101612-30072007>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<STRONG><EM><FONT face=Arial color=#0000ff>benc = 0; 
</FONT></EM></STRONG></SPAN></DIV>
<DIV><SPAN class=093101612-30072007>&nbsp;&nbsp;&nbsp; <STRONG><EM><FONT 
face=Arial color=#0000ff>}</FONT></EM></STRONG></SPAN></DIV>
<DIV><SPAN class=093101612-30072007><STRONG><EM><FONT face=Arial 
color=#0000ff></FONT></EM></STRONG></SPAN>&nbsp;</DIV>
<DIV><SPAN class=093101612-30072007><FONT face=Arial color=#0000ff>where 
<EM>abort_with_error() </EM>is your own function.</FONT></SPAN></DIV><BR>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> owner-openssl-users@openssl.org 
  [mailto:owner-openssl-users@openssl.org] <B>On Behalf Of </B>Pink 
  Princess<BR><B>Sent:</B> Monday, July 30, 2007 06:50<BR><B>To:</B> Brad 
  Hards<BR><B>Cc:</B> openssl-users@openssl.org<BR><B>Subject:</B> Re: Error 
  while encryption or Decrypting<BR></FONT><BR></DIV>
  <DIV></DIV>Dear brad<BR><BR>&nbsp;Thanks for the advice and the 
  hint<BR><BR><BR>I have been through the free commands to check where the error 
  occured<BR><BR><BR>In APPS folder in enc.c file<BR><BR>whenever I comment this 
  line(640)&nbsp; <BR>&nbsp; <SPAN 
  style="FONT-WEIGHT: bold; FONT-STYLE: italic">&nbsp; if (benc != NULL) 
  BIO_free(benc); </SPAN><BR>the dump core disappear<BR><BR><BR>I am working in 
  check what does this line mean and what is benc 
  <BR><BR><BR>regards<BR><BR><BR><BR>
  <DIV><SPAN class=gmail_quote>On 7/29/07, <B class=gmail_sendername>Brad 
  Hards</B> &lt;<A href="mailto:bradh@frogmouth.net">bradh@frogmouth.net</A>&gt; 
  wrote:</SPAN>
  <BLOCKQUOTE class=gmail_quote 
  style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">On 
    Saturday 28 July 2007 01:49, Pink Princess wrote:<BR>&gt; *** glibc detected 
    *** /home/noura/workspace/256OpenSSL/apps/openssl:<BR>&gt; double free or 
    corruption (!prev): 0x0820d170 ***<BR>This is the most likely problem - you 
    are free()ing memory that has already <BR>been free()d. Maybe you are 
    free()ing memory that openssl is cleaning up<BR>later.<BR><BR>Try running 
    under valgrind or a 
debugger.<BR><BR>Brad<BR><BR></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majordomo@openssl.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic