Holger Hans Peter Freyther
authored
Do not crash when a URL has no path component as in this case the ast_uri_path function will return NULL. Make the code cope with not having a path. The below would crash > media cache create http://google.com /tmp/foo.wav Thread 1 "asterisk" received signal SIGSEGV, Segmentation fault. 0x0000ffff836616cc in strrchr () from /lib/aarch64-linux-gnu/libc.so.6 (gdb) bt #0 0x0000ffff836616cc in strrchr () from /lib/aarch64-linux-gnu/libc.so.6 #1 0x0000ffff43d43a78 in file_extension_from_string (str=<optimized out>, buffer=buffer@entry=0xffffca9973c0 "", capacity=capacity@entry=64) at res_http_media_cache.c:288 #2 0x0000ffff43d43bac in file_extension_from_url_path (bucket_file=bucket_file@entry=0x3bf96568, buffer=buffer@entry=0xffffca9973c0 "", capacity=capacity@entry=64) at res_http_media_cache.c:378 #3 0x0000ffff43d43c74 in bucket_file_set_extension (bucket_file=bucket_file@entry=0x3bf96568) at res_http_media_cache.c:392 #4 0x0000ffff43d43d10 in bucket_file_run_curl (bucket_file=0x3bf96568) at res_http_media_cache.c:555 #5 0x0000ffff43d43f74 in bucket_http_wizard_create (sorcery=<optimized out>, data=<optimized out>, object=<optimized out>) at res_http_media_cache.c:613 #6 0x0000000000487638 in bucket_file_wizard_create (sorcery=<optimized out>, data=<optimized out>, object=<optimized out>) at bucket.c:191 #7 0x0000000000554408 in sorcery_wizard_create (object_wizard=object_wizard@entry=0x3b9f0718, details=details@entry=0xffffca9974a8) at sorcery.c:2027 #8 0x0000000000559698 in ast_sorcery_create (sorcery=<optimized out>, object=object@entry=0x3bf96568) at sorcery.c:2077 #9 0x00000000004893a4 in ast_bucket_file_create (file=file@entry=0x3bf96568) at bucket.c:727 #10 0x00000000004f877c in ast_media_cache_create_or_update (uri=0x3bfa1103 "https://google.com", file_path=0x3bfa1116 "/tmp/foo.wav", metadata=metadata@entry=0x0) at media_cache.c:335 #11 0x00000000004f88ec in media_cache_handle_create_item (e=<optimized out>, cmd=<optimized out>, a=0xffffca9976b8) at media_cache.c:640 ASTERISK-30375 #close Change-Id: I6a9433688cb5d3d4be8758b7642d923bdde6c273
Name | Last commit | Last update |
---|