Skip to content

Segfault on large POST body #10

@mnutt

Description

@mnutt

I'm seeing a segfault when POSTing with a large-ish (400KB) content body when running a pillow server on qt 5.10. The segfault I get is:

#0  0x00007ffff4c1e77e in Pillow::HttpConnectionPrivate::initialize (this=0x60400000b080) at HttpConnection.cpp:146
#1  0x00007ffff4c1cac8 in Pillow::HttpConnection::initialize (this=0x600600007f60, inputDevice=0x6004002e5f10, outputDevice=0x6004002e5f10) at HttpConnection.cpp:664
#2  0x00007ffff4c10064 in Pillow::HttpServer::incomingConnection (this=0x7fffffffe330, socketDescriptor=12) at HttpServer.cpp:92
#3  0x00007ffff7f4a4b0 in QTcpServerPrivate::readNotification (this=0x60200000f940) at socket/qtcpserver.cpp:221
#4  0x00007ffff7f54441 in QReadNotifier::event (this=<optimized out>, e=<optimized out>) at socket/qnativesocketengine.cpp:1274
#5  0x00007ffff1735f3c in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x6006000075a0, e=0x7fffffffde80) at kernel/qapplication.cpp:3732
#6  0x00007ffff173d070 in QApplication::notify (this=0x7fffffffe270, receiver=0x6006000075a0, e=0x7fffffffde80) at kernel/qapplication.cpp:3491
#7  0x00007ffff0d66d25 in QCoreApplication::notifyInternal2 (receiver=0x6006000075a0, event=event@entry=0x7fffffffde80) at kernel/qcoreapplication.cpp:1050
#8  0x00007ffff0dbaa0e in QCoreApplication::sendEvent (event=0x7fffffffde80, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234
#9  socketNotifierSourceDispatch (source=0x601600009830) at kernel/qeventdispatcher_glib.cpp:106
#10 0x00007fffeb3afe14 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#11 0x00007fffeb3b0058 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007fffeb3b00fc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#13 0x00007ffff0db9ddc in QEventDispatcherGlib::processEvents (this=0x60060000cfd0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#14 0x00007fffe5483451 in QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /opt/qt510/plugins/platforms/libheadless.so
#15 0x00007ffff0d652ab in QEventLoop::exec (this=this@entry=0x7fffffffe0a0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212
#16 0x00007ffff0d6dc14 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1338
#17 0x0000000000453e1a in main (argc=1, argv=0x7fffffffe4b8) at main.cpp:130

The line: https://github.com/acossette/pillow/blob/master/pillowcore/HttpConnection.cpp#L146

When this happens, the first request actually completes successfully but the following request is the one that segfaults. I've debugged it, and it looks like _requestBuffer.data_ptr()->size is already zero so I'm not sure why setting it to zero again might be an issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions