Issue 7965 - heap corruption due to returning a reference to the local variable
Summary: heap corruption due to returning a reference to the local variable
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.40
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-14 11:30 UTC by Leonid Yuriev
Modified: 2015-07-02 17:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Leonid Yuriev 2014-10-14 11:30:42 UTC
Full_Name: Leonid Yuriev
Version: 2.4.40
OS: RHEL7
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (31.130.36.33)


#4  0x00000030e1834105 in abort () from /lib64/libc.so.6
#5  0x00000030e1876190 in malloc_printerr () from /lib64/libc.so.6
#6  0x00000000004cc593 in mdb_dn2entry (op=0x7ff36ef32380, tid=0xeb44d0, m2=0x0,
dn=0x7ff36ef323b8, e=0x7ff36ef31188, nsubs=<value optimized out>, matched=1) at
dn2entry.c:75
        mdb = 0x7ff3980da010
        rc = -30782
        rc2 = <value optimized out>
        id = 18446744073709551615
                                    0x7ff36ef30db8
        mbv = {bv_len = 0, bv_val = 0x7ff36ef30ebe ""}
        nmbv = {bv_len = 0, bv_val = 0x0}
        mc = 0x0

while the rsp is 0x7ff36ef30db8

#7  0x00000000004a6707 in mdb_modify (op=0x7ff36ef32380, rs=0x7ff36ef31450) at
modify.c:531
#8  0x0000000000487fc7 in overlay_op_walk (op=0x7ff36ef32380, rs=0x7ff36ef31450,
which=op_modify, oi=0xe0e840, on=0x0) at backover.c:671
#9  0x00000000004889b3 in over_op_func (op=0x7ff36ef32380, rs=<value optimized
out>, which=<value optimized out>) at backover.c:723
#10 0x000000000047c74inin syncrepl_del_nonpresent (op=0x7ff36ef32380,
si=0xdcc570, uuids=<value optimized out>, sc=0x7ff36ef314c0, m=89008752) at
syncrepl.c:3452
#11 0x0000000000480e92 in do_syncrep2 (op=0x7ff36ef32380, si=0xdcc570) at
syncrepl.c:1335
#12 0x00000000004843c2 in do_syncrepl (ctx=<value optimized out>, arg=0xdcc9d0)
at syncrepl.c:1539
#13 0x00007ff3987e2868 in ldap_int_thread_pool_wrapper (xpool=0xd79e80) at
tpool.c:688

Comment 1 Leonid Yuriev 2014-10-14 11:34:40 UTC
The attached files is derived from OpenLDAP Software. All of the modifications
to OpenLDAP Software represented in the following patch(es) were developed by
Peter-Service LLC, Moscow, Russia. Peter-Service LLC has not assigned rights
and/or interest in this work to any party. I, Leonid Yuriev am authorized by
Peter-Service LLC, my employer, to release this work under the following terms.

Peter-Service LLC hereby places the following modifications to OpenLDAP Software
(and only these modifications) into the public domain. Hence, these
modifications may be freely used and/or redistributed for any purpose with or
without attribution and/or other notice.

https://github.com/leo-yuriev/openldap-lmdb-challenge/commit/1d29214f60300c838810b0954264550d4fc86f18

Author: Leo Yuriev <leo@yuriev.ru>
Date:   2014-10-14 14:49:25 +0400

     BUGFIX - lmdb-backend: heap corruption due to returning a
reference to the local variable.

diff --git a/servers/slapd/back-mdb/dn2id.c b/servers/slapd/back-mdb/dn2id.c
index 06e6ad3..41c4758 100644
--- a/servers/slapd/back-mdb/dn2id.c
+++ b/servers/slapd/back-mdb/dn2id.c
@@ -346,7 +346,7 @@ mdb_dn2id(
                cursor = mc;
        } else {
                rc = mdb_cursor_open( txn, dbi, &cursor );
-               if ( rc ) return rc;
+               if ( rc ) goto done;
        }

        for (;;) {
@@ -470,7 +470,7 @@ mdb_dn2sups(
        key.mv_size = sizeof(ID);

        rc = mdb_cursor_open( txn, dbi, &cursor );
-       if ( rc ) return rc;
+       if ( rc ) goto done;

        for (;;) {
                key.mv_data = &pid;

Comment 2 Howard Chu 2014-10-14 12:17:20 UTC
Леонид Юрьев wrote:
> The attached files is derived from OpenLDAP Software. All of the modifications
> to OpenLDAP Software represented in the following patch(es) were developed by
> Peter-Service LLC, Moscow, Russia. Peter-Service LLC has not assigned rights
> and/or interest in this work to any party. I, Leonid Yuriev am authorized by
> Peter-Service LLC, my employer, to release this work under the following terms.
>
> Peter-Service LLC hereby places the following modifications to OpenLDAP Software
> (and only these modifications) into the public domain. Hence, these
> modifications may be freely used and/or redistributed for any purpose with or
> without attribution and/or other notice.

Thanks, committed to git master.

> https://github.com/leo-yuriev/openldap-lmdb-challenge/commit/1d29214f60300c838810b0954264550d4fc86f18
>
> Author: Leo Yuriev <leo@yuriev.ru>
> Date:   2014-10-14 14:49:25 +0400
>
>       BUGFIX - lmdb-backend: heap corruption due to returning a
> reference to the local variable.
>
> diff --git a/servers/slapd/back-mdb/dn2id.c b/servers/slapd/back-mdb/dn2id.c
> index 06e6ad3..41c4758 100644
> --- a/servers/slapd/back-mdb/dn2id.c
> +++ b/servers/slapd/back-mdb/dn2id.c
> @@ -346,7 +346,7 @@ mdb_dn2id(
>                  cursor = mc;
>          } else {
>                  rc = mdb_cursor_open( txn, dbi, &cursor );
> -               if ( rc ) return rc;
> +               if ( rc ) goto done;
>          }
>
>          for (;;) {
> @@ -470,7 +470,7 @@ mdb_dn2sups(
>          key.mv_size = sizeof(ID);
>
>          rc = mdb_cursor_open( txn, dbi, &cursor );
> -       if ( rc ) return rc;
> +       if ( rc ) goto done;
>
>          for (;;) {
>                  key.mv_data = &pid;
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 3 Howard Chu 2014-10-14 12:18:12 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 4 Quanah Gibson-Mount 2014-12-10 23:26:45 UTC
changed notes
changed state Test to Release
Comment 5 OpenLDAP project 2015-07-02 17:45:20 UTC
fixed in master
fixed in RE25
fixed in RE24
Comment 6 Quanah Gibson-Mount 2015-07-02 17:45:20 UTC
changed notes
changed state Release to Closed