M
M
Maxim Barulin2014-05-24 12:32:53
OpenSSL
Maxim Barulin, 2014-05-24 12:32:53

C++ how to determine why an application is crashing?

Good day,% habrauser%!
I am writing a simple fcgi application using openssl that will encrypt/decrypt incoming data. I don't know much about C++, everything is collected from examples and finished with a file, so there may be strange things, please point them out :) so that you can fix it. The first problem is that the application in windows crashes on the second request (this is not observed under ubuntu), the first one works fine. The second problem is that in windows the correct data is displayed in the console after decryption, but when answering a request, in addition to the main data, there are still line breaks and a piece of the "left" line, and in ubuntu the data is not decrypted at all.
I collect the team

g++ function.cpp main.cpp -o encrypt -I/usr/include/openssl/ -L/usr/lib/ssl/ -lssl -lcrypto -lfcgi -ldl -lpthread -lboost_regex

I would be grateful for any help!
Sources here https://github.com/Slavenin/fcgi_encrypt

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Maxim Barulin, 2014-05-29
@Slavenin999

refactoring will save the world :) I should have been more careful with pointers.
but there was another problem , I will be grateful for the help!

E
EXL, 2014-05-24
@EXL

Learn to use a debugger. For Windows and Ubuntu, the GDB debugger is great. Build the program with the -g flag, then load it into gdb:
In GDB, give the command to run (type run, press Enter). Cause a crash in your program, enter the "bt" command, which will let you know which function your program crashed on.

K
KOLANICH, 2014-05-24
@KOLANICH

try setting up a static analyzer

S
Sergey Savostin, 2014-05-24
@savostin

Not an expert.
Try moving OpenSSL_add_all_algorithms, EVP_cleanup and OPENSSL_config out of the encript_scring function so that they are only called once.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question