Project

General

Profile

[Solved] segfault with mod_flv_streaming

Added by fab over 5 years ago

Hello

I have a segfault with mod_flv_streaming
no segfault with 1.4.50 but segfault with 1.4.51 and 1.4.52

http://domain.com/video.flv

[794847.233364] lighttpd[2346]: segfault at 0 ip 00007fe0a62c1138 sp 00007ffd3511a2b0 error 4 in mod_flv_streaming.so (deleted)[7fe0a62c0000+2000]

if query param is present on url no segfault

http://domain.com/video.flv?start=...

i join a trace of valgring debug in attach file

i suppose a probleme with function split_get_params

....
==7365== Invalid read of size 1
==7365==    at 0x7F62120: split_get_params (mod_flv_streaming.c:125)
==7365==    by 0x7F622E6: mod_flv_streaming_path_handler (mod_flv_streaming.c:174)
==7365==    by 0x432647: plugins_call_handle_physical (plugin.c:342)
==7365==    by 0x40EFD6: http_response_prepare (response.c:634)
==7365==    by 0x411EE6: connection_state_machine (connections.c:1157)
==7365==    by 0x412C6E: network_server_handle_fdevent (network.c:65)
==7365==    by 0x40D2F4: server_main (server.c:2024)
==7365==    by 0x40D575: main (server.c:2091)
==7365==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==7365== 
==7365== 
==7365== Process terminating with default action of signal 11 (SIGSEGV)
==7365==  Access not within mapped region at address 0x0
==7365==    at 0x7F62120: split_get_params (mod_flv_streaming.c:125)
==7365==    by 0x7F622E6: mod_flv_streaming_path_handler (mod_flv_streaming.c:174)

Replies (2)

RE: segfault with mod_flv_streaming - Added by gstrauss over 5 years ago

Sorry. Yes, that is a bug.

==2847== Process terminating with default action of signal 11 (SIGSEGV)
==2847==  Access not within mapped region at address 0x0
==2847==    at 0x7F62120: split_get_params (mod_flv_streaming.c:125)
==2847==    by 0x7F622E6: mod_flv_streaming_path_handler (mod_flv_streaming.c:174)

This should fix it:

--- a/src/mod_flv_streaming.c
+++ b/src/mod_flv_streaming.c
@@ -121,6 +121,7 @@ static int split_get_params(array *get_params, buffer *qrystr) {
        size_t is_key = 1, klen = 0;
        char *key = qrystr->ptr, *val = NULL;

+       if (buffer_string_is_empty(qrystr)) return 0;
        for (size_t i = 0, len = buffer_string_length(qrystr); i <= len; ++i) {
                switch(qrystr->ptr[i]) {
                case '=':

A workaround until the patch is released might be to use mod_rewrite with url.rewrite-once = ( "\.flv$" => "${url.path}?" )

Does that work for you?

RE: segfault with mod_flv_streaming - Added by fab over 5 years ago

workaround rewrite is perfect !

and patch as well good

big thanks Glenn

-- fab

    (1-2/2)