Giter Site home page Giter Site logo

Comments (12)

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

This seems to happen for each POST route

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

SIPI server crashes when receiving a POST request with the header "Content-Type: application/x-www-form-urlencoded"

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

in commit 29e675c, in shttps/Connection.cpp, the following lines were removed:

if ((bodybuf = (char *) malloc((content_length + 1)*sizeof(char))) == NULL) {
 -                                throw Error(__file__, __LINE__, "malloc failed!", errno);
 -                            }
 -                            ins->read(bodybuf, content_length);
 -                            if (ins->fail() ||ins->eof()) {
 -                                free(bodybuf);
 -                                throw -1;
 -                            }
 -                            bodybuf[content_length] = '\0';

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

as a consequence, bodybuf may be NULL:

if (content_length > 0) {
                    vector<string> content_type_opts = process_header_value(header_in["content-type"]);
                    if (content_type_opts[0] == "application/x-www-form-urlencoded") {
                        char *bodybuf = NULL;
                        if (_chunked_transfer_in) {
                            ChunkReader ckrd(ins);
                            (void) ckrd.readAll(&bodybuf);
                        }
                        else {
                        }
                        string body = bodybuf;
                        post_params = parse_query_string(body, true);
                        request_params.insert(post_params.begin(), post_params.end());

                        free(bodybuf);
                    }

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024
Starting program: /Users/tobi/gitreps/Sipi-github/local/bin/sipi -config config/sipi.config.lua
[New Thread 0x1313 of process 3268]
[New Thread 0x1403 of process 3268]

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x1313 of process 3268]
0x00007fff8ff4d152 in strlen () from /usr/lib/system/libsystem_c.dylib
(gdb) backtrace
#0  0x00007fff8ff4d152 in strlen () from /usr/lib/system/libsystem_c.dylib
#1  0x000000010003b005 in std::__1::char_traits<char>::length(char const*) ()
#2  0x00000001004a0dec in std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string (this=0x7000000fc6c0, __s=0x0)
    at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2005
#3  std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string (
    this=0x7000000fc6c0, __s=0x0)
    at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:2003
#4  shttps::Connection::Connection (this=0x700000100608, server_p=0x7fff5fbff310, ins_p=0x700000100a18, 
    os_p=0x700000100968, tmpdir_p=..., buf_size=0, buf_inc=8192)
    at /Users/tobi/gitreps/Sipi-github/lib/shttps/Connection.cpp:480
#5  0x00000001004ac0ad in shttps::Connection::Connection (this=0x700000100608, server_p=0x7fff5fbff310, 
    ins_p=0x700000100a18, os_p=0x700000100968, tmpdir_p=..., buf_size=0, buf_inc=8192)
    at /Users/tobi/gitreps/Sipi-github/lib/shttps/Connection.cpp:361
#6  0x00000001004ed6d4 in shttps::Server::processRequest (this=0x7fff5fbff310, sock=6, peer_ip=..., peer_port=49883)
    at /Users/tobi/gitreps/Sipi-github/lib/shttps/Server.cpp:597
#7  0x00000001004ed0a9 in shttps::process_request (arg=0x100e000a0)
    at /Users/tobi/gitreps/Sipi-github/lib/shttps/Server.cpp:427
#8  0x00007fff9609099d in ?? () from /usr/lib/system/libsystem_pthread.dylib
#9  0x0000000000001103 in ?? ()
#10 0x0000700000104000 in ?? ()
#11 0x0000700000103f50 in ?? ()
#12 0x00007fff9609091a in ?? () from /usr/lib/system/libsystem_pthread.dylib
#13 0x0000000000000000 in ?? ()

from sipi.

lrosenth avatar lrosenth commented on July 17, 2024

Hallo Tobias,
ja, da ist was schief gelaufen. Habe den Code mit malloc wieder rein getan. Bin am testen..

Liebe Grüsse,
Lukas

Prof. Dr. Lukas Rosenthaler
Head of "Digital Humanities Lab",
University of Basel
Bernoullistrasse 32
CH-4056 Basel, Switzerland

Tel: + 41 61 267 0490
Fax: +41 61 267 3855
http://www.dhlab.unibas.ch

On 20 Jun 2016, at 18:52, Tobias Schweizer [email protected] wrote:

as a consequence, bodybuf may be NULL:

if (content_length > 0) {
vector content_type_opts = process_header_value(header_in["content-type"]);
if (content_type_opts[0] == "application/x-www-form-urlencoded") {
char *bodybuf = NULL;
if (_chunked_transfer_in) {
ChunkReader ckrd(ins);
(void) ckrd.readAll(&bodybuf);
}
else {
}
string body = bodybuf;
post_params = parse_query_string(body, true);
request_params.insert(post_params.begin(), post_params.end());

                    free(bodybuf);
                }


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub #33 (comment), or mute the thread https://github.com/notifications/unsubscribe/AFN9zN-qP5T4DuSDRdHDvHL8HLd-pVo5ks5qNsUxgaJpZM4I5pXO.

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

Habe mich zunächst nur gewundert, warum da keine POST params mehr sind im Lua script :-)

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

ok, openssl branch you have committed your fix to works for me now.

Now this should be fixed in develop to

from sipi.

lrosenth avatar lrosenth commented on July 17, 2024

I’ll do it :-)

Prof. Dr. Lukas Rosenthaler
Head of "Digital Humanities Lab",
University of Basel
Bernoullistrasse 32
CH-4056 Basel, Switzerland

Tel: + 41 61 267 0490
Fax: +41 61 267 3855
http://www.dhlab.unibas.ch

On 21 Jun 2016, at 00:28, Tobias Schweizer [email protected] wrote:

ok, openssl branch you have committed your fix to works for me now.

Now this should be fixed in develop to


You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub #33 (comment), or mute the thread https://github.com/notifications/unsubscribe/AFN9zOxkSQwJuwF_oplJ96eaqJSIUWvWks5qNxQqgaJpZM4I5pXO.

from sipi.

tobiasschweizer avatar tobiasschweizer commented on July 17, 2024

great :-)

from sipi.

BiancoA avatar BiancoA commented on July 17, 2024

solved?

from sipi.

lrosenth avatar lrosenth commented on July 17, 2024

Solved

from sipi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.