I start my mongoose with following options and mongoose starts successfully.
mongoose -ssl_cert /etc/mycert.pem -ports 8081,443s
I have a client application communication with mongoose server on port 8081 and a different application
communicating securely on port 443.
Mongoose comes up and waits followed by application 1 and application 2 coming up simultaneously.
I see a crash with following backtrace in openssl library used by mongoose. (These is no crash and everything is up and running if I don't bring application 2 which talks https with mongoose server)
Program terminated with signal 11, Segmentation fault.
Thread 1 (Thread 1171):
#0 ssl3_read_internal (s=0xea67a0, buf=0x75cf28, len=16384, peek=0) at s3_lib.c:4205
#1 0x770ef2fc in pull (fp=<value optimized out>, conn=0x75cc80, buf=<value optimized out>, len=<value optimized out>) at mongoose.c:1483
#2 0x770ef404 in read_request (fp=0x0, conn=0x75cc80, buf=0x75cf28 "GET", bufsiz=16384, nread=0x75cf0c) at mongoose.c:2882
#3 0x770efa08 in getreq (conn=0x75cc80, ebuf=0x76507ecc "", ebuf_len=100) at mongoose.c:4738
#4 0x770f6be4 in process_new_connection (thread_func_param=0x72a100) at mongoose.c:4798
#5 worker_thread (thread_func_param=0x72a100) at mongoose.c:4904
#6 0x76fc8a08 in start_thread (arg=0x765084f0) at libpthread/nptl/pthread_create.c:297
#7 0x76fbd5c0 in __thread_start () at ./libc/sysdeps/linux/mips/clone.S:146
Backtrace stopped: frame did not save the PC
(gdb) t 1
[Switching to thread 1 (Thread 1171)]#0 ssl3_read_internal (s=0xea67a0, buf=0x75cf28, len=16384, peek=0) at s3_lib.c:4205
4205 in s3_lib.c
(gdb) yp
Undefined command: "yp". Try "help".
(gdb) up
#1 0x770ef2fc in pull (fp=<value optimized out>, conn=0x75cc80, buf=<value optimized out>, len=<value optimized out>) at mongoose.c:1483
1483 mongoose.c: No such file or directory.
in mongoose.c
(gdb) down
#0 ssl3_read_internal (s=0xea67a0, buf=0x75cf28, len=16384, peek=0) at s3_lib.c:4205
4205 s3_lib.c: No such file or directory.
in s3_lib.c
(gdb) down
Bottom (innermost) frame selected; you cannot go down.
(gdb)
#0 ssl3_read_internal (s=0xe05a38, buf=0x743738, len=16384, peek=0) at s3_lib.c:4205
4205 s3_lib.c: No such file or directory.
in s3_lib.c
(gdb)
(gdb)
(gdb)
(gdb) p s
$1 = (SSL *) 0xe05a38
(gdb) p s_s3
No symbol "s_s3" in current context.
(gdb) p s->s3
$2 = (struct ssl3_state_st *) 0x0
(gdb)
static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
{
int ret;
clear_sys_error();
//Below is line 4205
if (s->s3->renegotiate) ssl3_renegotiate_check(s);
s->s3->in_read_app_data=1;
ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);
if ((ret == -1) && (s->s3->in_read_app_data == 2))
{
Seems like s->s3 pointer becomes NULL for some reasons and hence the crash.
I am using libcurl library.(openssl being used is openssl-1.0.1e).