Re: Segmentation fault: what's wrong with this code?
Neil Horman <[email protected]> Fri, 5 Jun 2026 17:15:53 -0400
| Newsgroups | gmane.comp.encryption.openssl.user |
|---|---|
| Message-ID | <CAJbOq15_O33WuD_YaKgHP82KKuEnV1aNkCzBUAiAYP1UgPM63Q@mail.gmail.com> |
--0000000000001dc8690653882be2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Nothing looks especially wrong here. Is the decode process successful? I.e. does your private key get printed out after a successful return from OSSL_DECODER_from_data? If not, my first guess would be theres some bug in the decode path in which pkey is allocated and freed but the object pointer isn't reset to NULL leading to in invalid dereference in EVP_PKEY_free because the NULL check there erroneously fails. Neil On Fri, Jun 5, 2026 at 4:35=E2=80=AFPM Stef Bon <[email protected]> wrote: > > Yes > Module /home/sbon/Projects/archive/openssl/openssh/test > without build-id. > Module ld-linux-x86-64.so.2 without build-id. > Module libc.so.6 without build-id. > Module libcrypto.so.3 without build-id. > Stack trace of thread 3061: > #0 0x00007f188b982e22 n/a (libcrypto.so.3 + 0x182e22) > #1 0x00007f188b983610 EVP_PKEY_free (libcrypto.so.3 + > 0x183610) > #2 0x0000557320c4534c PK_read_spk_from_OSSL_DECODER > (/home/sbon/Projects/archive/openssl/openssh/test + 0x334c) > #3 0x0000557320c456b3 PK_read_spk_from_handle > (/home/sbon/Projects/archive/openssl/openssh/test + 0x36b3) > #4 0x0000557320c458f3 main > (/home/sbon/Projects/archive/openssl/openssh/test + 0x38f3) > #5 0x00007f188b6301ae n/a (libc.so.6 + 0x271ae) > #6 0x00007f188b630269 __libc_start_main (libc.so.6 + > 0x27269) > #7 0x0000557320c434e5 _start > (/home/sbon/Projects/archive/openssl/openssh/test + 0x14e5) > ELF object binary architecture: AMD x86-64 > > > --=20 You received this message because you are subscribed to the Google Groups "= openssl-users" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org To view this discussion visit https://groups.google.com/a/openssl.org/d/msg= id/openssl-users/CAJbOq15_O33WuD_YaKgHP82KKuEnV1aNkCzBUAiAYP1UgPM63Q%40mail= .gmail.com. --0000000000001dc8690653882be2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Nothing looks especially=C2=A0wrong here.=C2=A0 Is the dec= ode process successful?=C2=A0 I.e. does your private key get printed out af= ter a successful return from=C2=A0OSSL_DECODER_from_data?=C2=A0 If not, my = first guess would be theres some bug in the decode=C2=A0path in which pkey = is allocated and freed but the object pointer isn't reset to NULL leadi= ng to in invalid dereference in EVP_PKEY_free because the NULL check there = erroneously fails.<div><br></div><div>Neil</div><div><br></div></div><br><d= iv class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gm= ail_attr">On Fri, Jun 5, 2026 at 4:35=E2=80=AFPM Stef Bon <<a href=3D"ma= ilto:[email protected]">[email protected]</a>> wrote:<br></div><blockquo= te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px = solid rgb(204,204,204);padding-left:1ex"><div><br></div><div>Yes</div>=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Module /home/sbon/Proj= ects/archive/openssl/openssh/test without build-id.<br>=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Module ld-linux-x86-64.so.2 without bui= ld-id.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Module li= bc.so.6 without build-id.<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 Module libcrypto.so.3 without build-id.<br>=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Stack trace of thread 3061:<br>=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #0 =C2=A00x00007f188b982e2= 2 n/a (libcrypto.so.3 + 0x182e22)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 #1 =C2=A00x00007f188b983610 EVP_PKEY_free (libcrypto.so.3= + 0x183610)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #2 = =C2=A00x0000557320c4534c PK_read_spk_from_OSSL_DECODER (/home/sbon/Projects= /archive/openssl/openssh/test + 0x334c)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 #3 =C2=A00x0000557320c456b3 PK_read_spk_from_handl= e (/home/sbon/Projects/archive/openssl/openssh/test + 0x36b3)<br>=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #4 =C2=A00x0000557320c458f3 m= ain (/home/sbon/Projects/archive/openssl/openssh/test + 0x38f3)<br>=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #5 =C2=A00x00007f188b6301a= e n/a (libc.so.6 + 0x271ae)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 #6 =C2=A00x00007f188b630269 __libc_start_main (libc.so.6 + 0x= 27269)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #7 =C2=A0= 0x0000557320c434e5 _start (/home/sbon/Projects/archive/openssl/openssh/test= + 0x14e5)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ELF o= bject binary architecture: AMD x86-64<br><br><div><br></div></blockquote></= div> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;openssl-users" group.<br /> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:openssl-users+unsubscribe-MCmKBN63+BlAfugRpC6u6w@public.gmane.org">openssl-us= [email protected]</a>.<br /> To view this discussion visit <a href=3D"https://groups.google.com/a/openss= l.org/d/msgid/openssl-users/CAJbOq15_O33WuD_YaKgHP82KKuEnV1aNkCzBUAiAYP1UgP= M63Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://group= s.google.com/a/openssl.org/d/msgid/openssl-users/CAJbOq15_O33WuD_YaKgHP82KK= uEnV1aNkCzBUAiAYP1UgPM63Q%40mail.gmail.com</a>.<br /> --0000000000001dc8690653882be2--