Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem install RPM: nothing provides libphp5 #3

Closed
uasan opened this issue Sep 6, 2017 · 2 comments
Closed

Problem install RPM: nothing provides libphp5 #3

uasan opened this issue Sep 6, 2017 · 2 comments

Comments

@uasan
Copy link

uasan commented Sep 6, 2017

Fedora 26
PHP 7.1 (installed: php-devel-7.1 php-embedded-7.1)

Try install package from repo
dnf install unit

Error:

Problem: conflicting requests
  - nothing provides libphp5-5.4.so()(64bit) needed by unit-0.1-1.el7.ngx.x86_64

How to fix it?

I guess i should try to compile everything with my hands :)

@banzayats
Copy link

I have the similar problem on my CentOS system (CentOS Linux release 7.3.1611).
PHP 5.6.31

# yum install unit                                                           
...                                              
Resolving Dependencies                                                                   
--> Running transaction check                                                            
---> Package unit.x86_64 0:0.1-1.el7.ngx will be installed                               
--> Processing Dependency: libphp5-5.4.so()(64bit) for package: unit-0.1-1.el7.ngx.x86_64
--> Finished Dependency Resolution                                                       
Error: Package: unit-0.1-1.el7.ngx.x86_64 (unit)                                         
           Requires: libphp5-5.4.so()(64bit)                                             
           Available: php-embedded-5.4.16-42.el7.x86_64 (base)                           
               libphp5-5.4.so()(64bit)                                                   
           Available: php-embedded-5.4.45-13.el7.remi.x86_64 (remi)                      
               libphp5-5.4.so()(64bit)                                                   
           Installed: php-embedded-5.6.31-1.el7.remi.x86_64 (@remi-php56)                
              ~libphp5-5.6.so()(64bit)                                                   
           Available: php-embedded-5.6.30-1.el7.remi.x86_64 (remi-php56)                 
              ~libphp5-5.6.so()(64bit)                                                   

@defanator
Copy link
Contributor

@uasan currently we provide binary packages for CentOS 7 and Ubuntu 16.04 only. You can always build Unit from sources though.

@banzayats at these early days we are sticking to PHP, Python and Go versions available out of the box in each supported distro; in case of CentOS 7, the only supported PHP version is 5.4. You may want to disable remi's repository and remove php-embedded package installed from that repository, or try to build Unit from sources.

However, we are open to any reasoned suggestions here - e.g. we've been thinking about a way of distributing each Unit dynamic module in a separate package (as we already do for nginx dynamic modules). In such scenario one would be able to install Unit itself (the daemon) without any strong dependencies on additional packages provided by OS, configure 3rd-party repositories with newer versions of PHP/Python/whatever, and build their own module (or even module package for further redistribution).

@uasan uasan closed this as completed Sep 9, 2017
nginx-hg-mirror pushed a commit that referenced this issue Dec 7, 2020
According to Section #3.1.2 of RFC 7230, after the status code
there must be a space even if the reason phrase is empty.

Also, only 3 digits allowed.

This closes #507 issue on GitHub.
4141done pushed a commit to 4141done/unit that referenced this issue Sep 21, 2023
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
http://hg.nginx.org/njs/rev/4fba78789fe4
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Same fix was introduced in NJS:
http://hg.nginx.org/njs/rev/612b52d8b07f
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
http://hg.nginx.org/njs/rev/4fba78789fe4
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Jan 31, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 7, 2024
These tests cause router crash when run with AddressSanitizer:

=================================================================
==77196==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000079340 at pc 0x55d56b132d4b bp 0x7f8cc7f346b0 sp 0x7f8cc7f346a0
READ of size 1 at 0x60c000079340 thread T1
    #0 0x55d56b132d4a in nxt_openssl_conn_io_shutdown src/nxt_openssl.c:1466
    nginx#1 0x55d56b0f6a25 in nxt_h1p_closing src/nxt_h1proto.c:2069
    nginx#2 0x55d56b1009a6 in nxt_h1p_shutdown src/nxt_h1proto.c:2038
    nginx#3 0x55d56b1014c3 in nxt_h1p_request_close src/nxt_h1proto.c:1718
    nginx#4 0x55d56b1045c0 in nxt_http_request_close_handler src/nxt_http_request.c:864
    nginx#5 0x55d56b104988 in nxt_http_request_done src/nxt_http_request.c:795
    nginx#6 0x55d56b0ba0c3 in nxt_event_engine_start src/nxt_event_engine.c:542
    nginx#7 0x55d56b0dcac2 in nxt_router_thread_start src/nxt_router.c:3645
    nginx#8 0x55d56b0b421b in nxt_thread_trampoline src/nxt_thread.c:126
    nginx#9 0x7f8ccab95ac2  (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2)
    nginx#10 0x7f8ccac2784f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 9, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 9, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 9, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 9, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 21, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 21, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 21, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 21, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17
andrey-zelenkov added a commit that referenced this issue Feb 21, 2024
These tests cause router crash when run with AddressSanitizer:

=================================================================
==77196==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000079340 at pc 0x55d56b132d4b bp 0x7f8cc7f346b0 sp 0x7f8cc7f346a0
READ of size 1 at 0x60c000079340 thread T1
    #0 0x55d56b132d4a in nxt_openssl_conn_io_shutdown src/nxt_openssl.c:1466
    #1 0x55d56b0f6a25 in nxt_h1p_closing src/nxt_h1proto.c:2069
    #2 0x55d56b1009a6 in nxt_h1p_shutdown src/nxt_h1proto.c:2038
    #3 0x55d56b1014c3 in nxt_h1p_request_close src/nxt_h1proto.c:1718
    #4 0x55d56b1045c0 in nxt_http_request_close_handler src/nxt_http_request.c:864
    #5 0x55d56b104988 in nxt_http_request_done src/nxt_http_request.c:795
    #6 0x55d56b0ba0c3 in nxt_event_engine_start src/nxt_event_engine.c:542
    #7 0x55d56b0dcac2 in nxt_router_thread_start src/nxt_router.c:3645
    #8 0x55d56b0b421b in nxt_thread_trampoline src/nxt_thread.c:126
    #9 0x7f8ccab95ac2  (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2)
    #10 0x7f8ccac2784f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 22, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 23, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 23, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 23, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit to andrey-zelenkov/unit that referenced this issue Feb 23, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit that referenced this issue Feb 27, 2024
These tests cause router crash when run with AddressSanitizer:

=================================================================
==77196==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000079340 at pc 0x55d56b132d4b bp 0x7f8cc7f346b0 sp 0x7f8cc7f346a0
READ of size 1 at 0x60c000079340 thread T1
    #0 0x55d56b132d4a in nxt_openssl_conn_io_shutdown src/nxt_openssl.c:1466
    #1 0x55d56b0f6a25 in nxt_h1p_closing src/nxt_h1proto.c:2069
    #2 0x55d56b1009a6 in nxt_h1p_shutdown src/nxt_h1proto.c:2038
    #3 0x55d56b1014c3 in nxt_h1p_request_close src/nxt_h1proto.c:1718
    #4 0x55d56b1045c0 in nxt_http_request_close_handler src/nxt_http_request.c:864
    #5 0x55d56b104988 in nxt_http_request_done src/nxt_http_request.c:795
    #6 0x55d56b0ba0c3 in nxt_event_engine_start src/nxt_event_engine.c:542
    #7 0x55d56b0dcac2 in nxt_router_thread_start src/nxt_router.c:3645
    #8 0x55d56b0b421b in nxt_thread_trampoline src/nxt_thread.c:126
    #9 0x7f8ccab95ac2  (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2)
    #10 0x7f8ccac2784f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
andrey-zelenkov added a commit that referenced this issue Mar 11, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    #1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    #2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    #3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    #4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    #5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    #6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    #7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit that referenced this issue Mar 11, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    #1 0x102598ad0 in njs_value_property njs_value.c:1175
    #2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    #3 0x102559d74 in nxt_js_call nxt_js.c:445
    #4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    #5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    #6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    #7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    #8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    #9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    #10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    #11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit that referenced this issue Mar 11, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    #1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    #2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    #3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    #4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    #5 0x104f27254 in main nxt_main.c:35
    #6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
andrey-zelenkov added a commit that referenced this issue Mar 11, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    #1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    #2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    #3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    #4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    #5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    #6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    #7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    #8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    #9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
pkillarjun pushed a commit to pkillarjun/unit that referenced this issue May 29, 2024
These tests cause router crash when run with AddressSanitizer:

=================================================================
==77196==ERROR: AddressSanitizer: heap-use-after-free on address 0x60c000079340 at pc 0x55d56b132d4b bp 0x7f8cc7f346b0 sp 0x7f8cc7f346a0
READ of size 1 at 0x60c000079340 thread T1
    #0 0x55d56b132d4a in nxt_openssl_conn_io_shutdown src/nxt_openssl.c:1466
    nginx#1 0x55d56b0f6a25 in nxt_h1p_closing src/nxt_h1proto.c:2069
    nginx#2 0x55d56b1009a6 in nxt_h1p_shutdown src/nxt_h1proto.c:2038
    nginx#3 0x55d56b1014c3 in nxt_h1p_request_close src/nxt_h1proto.c:1718
    nginx#4 0x55d56b1045c0 in nxt_http_request_close_handler src/nxt_http_request.c:864
    nginx#5 0x55d56b104988 in nxt_http_request_done src/nxt_http_request.c:795
    nginx#6 0x55d56b0ba0c3 in nxt_event_engine_start src/nxt_event_engine.c:542
    nginx#7 0x55d56b0dcac2 in nxt_router_thread_start src/nxt_router.c:3645
    nginx#8 0x55d56b0b421b in nxt_thread_trampoline src/nxt_thread.c:126
    nginx#9 0x7f8ccab95ac2  (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2)
    nginx#10 0x7f8ccac2784f  (/lib/x86_64-linux-gnu/libc.so.6+0x12684f)
pkillarjun pushed a commit to pkillarjun/unit that referenced this issue May 29, 2024
Otherwise, undefined behaviour will be triggered.

Can be reproduced by test/test_routing.py::test_routes_match_host_empty
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_route.c:2141:17: runtime error: applying zero offset to null pointer
    #0 0x100562588 in nxt_http_route_test_rule nxt_http_route.c:2091
    nginx#1 0x100564ed8 in nxt_http_route_handler nxt_http_route.c:1574
    nginx#2 0x10055188c in nxt_http_request_action nxt_http_request.c:570
    nginx#3 0x10052b1a0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#4 0x100449c38 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x100436828 in nxt_thread_trampoline nxt_thread.c:126
    nginx#6 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#7 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_route.c:2141:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
pkillarjun pushed a commit to pkillarjun/unit that referenced this issue May 29, 2024
Can be reproduced by test/test_rewrite.py::test_rewrite_njs
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_js.c:169:52: runtime error: applying zero offset to null pointer
    #0 0x10255b044 in nxt_http_js_ext_get_args nxt_http_js.c:169
    nginx#1 0x102598ad0 in njs_value_property njs_value.c:1175
    nginx#2 0x10259c2c8 in njs_vm_object_prop njs_vm.c:1398
    nginx#3 0x102559d74 in nxt_js_call nxt_js.c:445
    nginx#4 0x1023c0da0 in nxt_tstr_query nxt_tstr.c:276
    nginx#5 0x102516ec4 in nxt_http_rewrite nxt_http_rewrite.c:56
    nginx#6 0x1024fd86c in nxt_http_request_action nxt_http_request.c:565
    nginx#7 0x1024d71b0 in nxt_h1p_request_body_read nxt_h1proto.c:998
    nginx#8 0x1023f5c48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#9 0x1023e2838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#10 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#11 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_js.c:169:52

Same fix was introduced in NJS:
<http://hg.nginx.org/njs/rev/4fba78789fe4>

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
pkillarjun pushed a commit to pkillarjun/unit that referenced this issue May 29, 2024
Found by UndefinedBehaviorSanitizer:

src/nxt_random.c:151:31: runtime error: left shift of 140 by 24 places cannot be represented in type 'int'
    #0 0x104f78968 in nxt_random nxt_random.c:151
    nginx#1 0x104f58a98 in nxt_shm_open nxt_port_memory.c:377
    nginx#2 0x10503e24c in nxt_controller_conf_send nxt_controller.c:617
    nginx#3 0x105041154 in nxt_controller_process_request nxt_controller.c:1109
    nginx#4 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#5 0x104f27254 in main nxt_main.c:35
    nginx#6 0x180fbd0dc  (<unknown module>)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_random.c:151:31

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
pkillarjun pushed a commit to pkillarjun/unit that referenced this issue May 29, 2024
Can be reproduced by test/test_variables.py::test_variables_dynamic_arguments
with enabled UndefinedBehaviorSanitizer:

src/nxt_http_request.c:961:17: runtime error: applying zero offset to null pointer
    #0 0x1050d95a4 in nxt_http_arguments_parse nxt_http_request.c:961
    nginx#1 0x105102bf8 in nxt_http_var_arg nxt_http_variables.c:621
    nginx#2 0x104f95d74 in nxt_var_interpreter nxt_var.c:507
    nginx#3 0x104f98c98 in nxt_tstr_query nxt_tstr.c:265
    nginx#4 0x1050abfd8 in nxt_router_access_log_writer nxt_router_access_log.c:194
    nginx#5 0x1050d81f4 in nxt_http_request_close_handler nxt_http_request.c:838
    nginx#6 0x104fcdc48 in nxt_event_engine_start nxt_event_engine.c:542
    nginx#7 0x104fba838 in nxt_thread_trampoline nxt_thread.c:126
    nginx#8 0x18133e030 in _pthread_start+0x84 (libsystem_pthread.dylib:arm64e+0x7030)
    nginx#9 0x181338e38 in thread_start+0x4 (libsystem_pthread.dylib:arm64e+0x1e38)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/nxt_http_request.c:961:17

Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
ac000 referenced this issue in ac000/unit Jun 25, 2024
This issue was found with oss-fuzz.

  ==18420==WARNING: MemorySanitizer: use-of-uninitialized-value
	      #0 0x55dd798a5797 in nxt_vsprintf unit/src/nxt_sprintf.c:163:31
	      #1 0x55dd798d5bdb in nxt_conf_vldt_error unit/src/nxt_conf_validation.c:1525:11
	      #2 0x55dd798dd4cd in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1560:16
	      #3 0x55dd798dd4cd in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16
	      nginx#4 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#5 0x55dd798d6f84 in nxt_conf_vldt_access_log unit/src/nxt_conf_validation.c:3426:11
	      nginx#6 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#7 0x55dd798d47bd in nxt_conf_validate unit/src/nxt_conf_validation.c:1421:11
	      nginx#8 0x55dd79871c82 in LLVMFuzzerTestOneInput unit/fuzzing/nxt_json_fuzz.c:67:5
	      nginx#9 0x55dd79770620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
	      nginx#10 0x55dd7975adb4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
	      nginx#11 0x55dd7976084a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
	      nginx#12 0x55dd7978cc42 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
	      nginx#13 0x7e8192213082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
	      nginx#14 0x55dd7975188d in _start

	    Uninitialized value was created by an allocation of 'error.i' in the stack frame
	      #0 0x55dd798dd42b in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1557:5
	      #1 0x55dd798dd42b in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16

The issue was in nxt_tstr_test() where we create an error message with
nxt_sprintf(), where this error message is then later used with the
'%s' format specifier which expects a nul-terminated string, but by
default nxt_sprintf() doesn't nul-terminate, you must use the '%Z'
specifier to signify a '\0' at the end of the string.

Link: <https://github.com/google/oss-fuzz>
Link: <https://oss-fuzz.com/testcase-detail/5545917827055616>
Co-developed-by: Zhidao HONG <z.hong@f5.com>
Signed-off-by: Zhidao HONG <z.hong@f5.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Arjun <pkillarjun@protonmail.com>
[ Commit message/subject - Andrew ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
ac000 referenced this issue in ac000/unit Jun 25, 2024
This issue was found with oss-fuzz.

  ==18420==WARNING: MemorySanitizer: use-of-uninitialized-value
	      #0 0x55dd798a5797 in nxt_vsprintf unit/src/nxt_sprintf.c:163:31
	      #1 0x55dd798d5bdb in nxt_conf_vldt_error unit/src/nxt_conf_validation.c:1525:11
	      #2 0x55dd798dd4cd in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1560:16
	      #3 0x55dd798dd4cd in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16
	      nginx#4 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#5 0x55dd798d6f84 in nxt_conf_vldt_access_log unit/src/nxt_conf_validation.c:3426:11
	      nginx#6 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#7 0x55dd798d47bd in nxt_conf_validate unit/src/nxt_conf_validation.c:1421:11
	      nginx#8 0x55dd79871c82 in LLVMFuzzerTestOneInput unit/fuzzing/nxt_json_fuzz.c:67:5
	      nginx#9 0x55dd79770620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
	      nginx#10 0x55dd7975adb4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
	      nginx#11 0x55dd7976084a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
	      nginx#12 0x55dd7978cc42 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
	      nginx#13 0x7e8192213082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
	      nginx#14 0x55dd7975188d in _start

	    Uninitialized value was created by an allocation of 'error.i' in the stack frame
	      #0 0x55dd798dd42b in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1557:5
	      #1 0x55dd798dd42b in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16

The issue was in nxt_tstr_test() where we create an error message with
nxt_sprintf(), where this error message is then later used with the
'%s' format specifier which expects a nul-terminated string, but by
default nxt_sprintf() doesn't nul-terminate, you must use the '%Z'
specifier to signify a '\0' at the end of the string.

Link: <https://github.com/google/oss-fuzz>
Link: <https://oss-fuzz.com/testcase-detail/5545917827055616>
Co-developed-by: Zhidao HONG <z.hong@f5.com>
Signed-off-by: Zhidao HONG <z.hong@f5.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Arjun <pkillarjun@protonmail.com>
[ Commit message/subject - Andrew ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
ac000 referenced this issue in ac000/unit Jun 25, 2024
This issue was found with oss-fuzz.

  ==18420==WARNING: MemorySanitizer: use-of-uninitialized-value
	      #0 0x55dd798a5797 in nxt_vsprintf unit/src/nxt_sprintf.c:163:31
	      #1 0x55dd798d5bdb in nxt_conf_vldt_error unit/src/nxt_conf_validation.c:1525:11
	      #2 0x55dd798dd4cd in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1560:16
	      #3 0x55dd798dd4cd in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16
	      nginx#4 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#5 0x55dd798d6f84 in nxt_conf_vldt_access_log unit/src/nxt_conf_validation.c:3426:11
	      nginx#6 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#7 0x55dd798d47bd in nxt_conf_validate unit/src/nxt_conf_validation.c:1421:11
	      nginx#8 0x55dd79871c82 in LLVMFuzzerTestOneInput unit/fuzzing/nxt_json_fuzz.c:67:5
	      nginx#9 0x55dd79770620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
	      nginx#10 0x55dd7975adb4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
	      nginx#11 0x55dd7976084a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
	      nginx#12 0x55dd7978cc42 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
	      nginx#13 0x7e8192213082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
	      nginx#14 0x55dd7975188d in _start

	    Uninitialized value was created by an allocation of 'error.i' in the stack frame
	      #0 0x55dd798dd42b in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1557:5
	      #1 0x55dd798dd42b in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16

The issue was in nxt_tstr_test() where we create an error message with
nxt_sprintf(), where this error message is then later used with the
'%s' format specifier which expects a nul-terminated string, but by
default nxt_sprintf() doesn't nul-terminate, you must use the '%Z'
specifier to signify a '\0' at the end of the string.

Link: <https://github.com/google/oss-fuzz>
Link: <https://oss-fuzz.com/testcase-detail/5545917827055616>
Co-developed-by: Zhidao HONG <z.hong@f5.com>
Signed-off-by: Zhidao HONG <z.hong@f5.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Signed-off-by: Arjun <pkillarjun@protonmail.com>
[ Commit message/subject - Andrew ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
ac000 referenced this issue in ac000/unit Jun 25, 2024
This issue was found with oss-fuzz.

  ==18420==WARNING: MemorySanitizer: use-of-uninitialized-value
	      #0 0x55dd798a5797 in nxt_vsprintf unit/src/nxt_sprintf.c:163:31
	      #1 0x55dd798d5bdb in nxt_conf_vldt_error unit/src/nxt_conf_validation.c:1525:11
	      #2 0x55dd798dd4cd in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1560:16
	      #3 0x55dd798dd4cd in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16
	      nginx#4 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#5 0x55dd798d6f84 in nxt_conf_vldt_access_log unit/src/nxt_conf_validation.c:3426:11
	      nginx#6 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#7 0x55dd798d47bd in nxt_conf_validate unit/src/nxt_conf_validation.c:1421:11
	      nginx#8 0x55dd79871c82 in LLVMFuzzerTestOneInput unit/fuzzing/nxt_json_fuzz.c:67:5
	      nginx#9 0x55dd79770620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
	      nginx#10 0x55dd7975adb4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
	      nginx#11 0x55dd7976084a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
	      nginx#12 0x55dd7978cc42 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
	      nginx#13 0x7e8192213082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
	      nginx#14 0x55dd7975188d in _start

	    Uninitialized value was created by an allocation of 'error.i' in the stack frame
	      #0 0x55dd798dd42b in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1557:5
	      #1 0x55dd798dd42b in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16

The issue was in nxt_tstr_test() where we create an error message with
nxt_sprintf(), where this error message is then later used with the
'%s' format specifier which expects a nul-terminated string, but by
default nxt_sprintf() doesn't nul-terminate, you must use the '%Z'
specifier to signify a '\0' at the end of the string.

Signed-off-by: Arjun <pkillarjun@protonmail.com>
Co-developed-by: Zhidao HONG <z.hong@f5.com>
Signed-off-by: Zhidao HONG <z.hong@f5.com>
Link: <https://github.com/google/oss-fuzz>
Link: <https://oss-fuzz.com/testcase-detail/5545917827055616>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
[ Commit message/subject - Andrew ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
ac000 referenced this issue in ac000/unit Jun 25, 2024
This issue was found with oss-fuzz.

  ==18420==WARNING: MemorySanitizer: use-of-uninitialized-value
	      #0 0x55dd798a5797 in nxt_vsprintf unit/src/nxt_sprintf.c:163:31
	      #1 0x55dd798d5bdb in nxt_conf_vldt_error unit/src/nxt_conf_validation.c:1525:11
	      #2 0x55dd798dd4cd in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1560:16
	      #3 0x55dd798dd4cd in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16
	      nginx#4 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#5 0x55dd798d6f84 in nxt_conf_vldt_access_log unit/src/nxt_conf_validation.c:3426:11
	      nginx#6 0x55dd798d55f4 in nxt_conf_vldt_object unit/src/nxt_conf_validation.c:2815:23
	      nginx#7 0x55dd798d47bd in nxt_conf_validate unit/src/nxt_conf_validation.c:1421:11
	      nginx#8 0x55dd79871c82 in LLVMFuzzerTestOneInput unit/fuzzing/nxt_json_fuzz.c:67:5
	      nginx#9 0x55dd79770620 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:614:13
	      nginx#10 0x55dd7975adb4 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:327:6
	      nginx#11 0x55dd7976084a in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:862:9
	      nginx#12 0x55dd7978cc42 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
	      nginx#13 0x7e8192213082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/libc-start.c:308:16
	      nginx#14 0x55dd7975188d in _start

	    Uninitialized value was created by an allocation of 'error.i' in the stack frame
	      #0 0x55dd798dd42b in nxt_conf_vldt_var unit/src/nxt_conf_validation.c:1557:5
	      #1 0x55dd798dd42b in nxt_conf_vldt_if unit/src/nxt_conf_validation.c:1592:16

The issue was in nxt_tstr_test() where we create an error message with
nxt_sprintf(), where this error message is then later used with the
'%s' format specifier which expects a nul-terminated string, but by
default nxt_sprintf() doesn't nul-terminate, you must use the '%Z'
specifier to signify a '\0' at the end of the string.

Signed-off-by: Arjun <pkillarjun@protonmail.com>
Co-developed-by: Zhidao HONG <z.hong@f5.com>
Signed-off-by: Zhidao HONG <z.hong@f5.com>
Link: <https://github.com/google/oss-fuzz>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
[ Commit message/subject - Andrew ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants