5101 Commits

Author SHA1 Message Date
Azat Khuzhin
612a74c766
Merge pull request #1441 from fanquake/autoconf_doc_updates
doc: minor autoconf/formatting improvements
2023-04-17 21:19:58 +02:00
fanquake
ac69410e1b
doc: mark Autotools as deprecated in building.md
Re-arrange so CMake is mentioned first.
Formatting improvements.
2023-04-17 14:42:59 +01:00
fanquake
2470b37bd1
doc: move autoconf link in readme to autoconf section. 2023-04-17 14:22:30 +01:00
lilinjie
4c993a0e7b
Fix typo in changelog (#1438) 2023-04-11 06:44:37 +02:00
Azat Khuzhin
f747a7b93b Prohibit VLA in autotools too 2023-04-04 22:19:07 +02:00
Azat Khuzhin
f04d90b121 Fix building with -Wstack-protector due to VLA and fobid them
It is not a thankless task to fix such issues on and on, let's just
prohibit this cases, and our build with -Werror on CI will show new
issues from now on.

Fixes: #1434
2023-04-04 22:17:14 +02:00
fanquake
1878232bd5 build: split kqueue warning message into cross-compile and apple
This is output when compiling (natively) on macOS systems, which is
confusing, because no cross-compilation is involved.

Split the message into separate cases.
2023-04-04 22:04:17 +02:00
zhenhaonong
fc568ff045 Deal with partial writes on SSL write
SSL write may do partial writes in some cases. For example, document
of mbedtls_ssl_write says:
  If the return value is non-negative but less than length, the function
  must be called again with updated arguments: buf + ret, len - ret
  (if ret is the return value) until it returns a value equal to the
  last 'len' argument.

In case of partial writes, we should continue writing the same chain of
buffer, not the next chain.
2023-03-29 06:19:10 +02:00
Liao Tonglang
9203d98ff8
http: style fix: use space between arguments list (#1435) 2023-03-26 22:35:00 +02:00
Azat Khuzhin
6e1826dd77 ci: fix typo in yaml for cifuzz
Follow-up for: #1431
2023-03-08 21:34:37 +01:00
Azat Khuzhin
606056d6e7 ci: switch to ubuntu 20.04
github action reports "internal error" for builds on ubuntu 18.04:

    linux-cmake-job (ubuntu-18.04, COMPILER_CLANG)
    This is a scheduled Ubuntu-18.04 brownout. The Ubuntu-18.04 environment is deprecated and will be removed on April 1st, 2023. For more details, see https://github.com/actions/runner-images/issues/6002

    linux-cmake-job (ubuntu-18.04, COMPILER_CLANG)
    GitHub Actions has encountered an internal error when running your job.
2023-03-07 06:15:33 +01:00
Diogo Teles Sant'Anna
99a4b1a786 ci: set minimal permissions on GitHub Actions
Change made by setting top-level read-only permisisons, and any
other necessary permissions set as job-level.

Closes #1421

Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>
2023-03-06 21:18:59 +01:00
Liao Tonglang
6bfa580559
http: Reduce times of checking if response has body (#1395)
Use a variable 'need_body' to store the result of
evhttp_response_needs_body(), then use the variable instead of call the function again.
2023-03-05 16:59:21 +01:00
Michael Ford
185e2f009b
build: improve mbedtls searching on macOS with brew for cmake (#1419)
This just copies the same logic used to find OpenSSL on macOS using homebrew, for finding mbedtls via brew. Without it, the build will fail out the box with a brew installed mbedtls.
2023-03-05 16:58:22 +01:00
Kurt Roeckx
4e6375e84c
Always have evutil_secure_rng_add_bytes available (#1427)
When libevent doesn't provide random the arc4 function, but they come from libc, there is no need to call this function, so make it do nothing.

Fixes: #1393
2023-03-05 16:56:56 +01:00
Zhipeng Xue
3a0cf34ba5 ws-chat-server: fix potential resource leak 2023-03-05 16:48:27 +01:00
Zhipeng Xue
bac9d10a6d
Fix potential null dereference in http-server (#1430)
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2023-03-04 22:13:54 +01:00
Zhipeng Xue
fa05966d74
test: fix potential null dereference in https_bind_ssl_bevcb (#1428)
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
2023-03-04 22:12:04 +01:00
Cœur
557990cad3 Optimize arc4random_uniform() (by syncing with OpenBSD implementation)
1. In d4de062, in Feb 2010, libevent adopted OpenBSD implementation of
   arc4random_uniform.
2. In
   728918cba9,
   in Jun 2012, OpenBSD improved their implementation to be faster, by
   changing arc4random_uniform() to calculate ``2**32 % upper_bound'' as
   ``-upper_bound % upper_bound''.

Alternatively we can simply remove arc4random_uniform() since it is not
used by libevent anyway, but let's just sync the header for now.
2023-03-02 07:51:14 +01:00
Cœur
e96e98aea5 evdns: fix "Branch condition evaluates to a garbage value" in reply_parse 2023-03-02 07:41:08 +01:00
Cœur
3bcc92cf59 Fix the value is never actually read from 'argument' in evhttp_parse_query_impl()
Although the value stored to 'argument' is used in the enclosing
expression, the value is never actually read from 'argument'
2023-03-02 07:32:17 +01:00
Cœur
b84fee24ab Fix "Value stored to 'a' is never read" in SHA1Transform()
Using same fix as used in android [1].

  [1]: android.googlesource.com/platform/dalvik/+/android-4.4.2_r2/libdex/sha1.cpp#193
2023-03-02 07:29:18 +01:00
Azat Khuzhin
bcefdbc67a
Merge pull request #1418 from fanquake/use_fortify_source_3
build: use FORTIFY_SOURCE=3 in hardening option
2023-02-14 09:56:03 +01:00
fanquake
e89ddd405b
build: use FORTIFY_SOURCE=3 in autotools build 2023-02-13 16:06:29 +00:00
fanquake
38cd76f09c
build: use FORTIFY_SOURCE=3 in CMake build 2023-02-13 16:05:58 +00:00
Azat Khuzhin
28c28f075b
Merge pull request #1414 from azat/build/deprecate-autotools
Deprecate autotools build
2023-02-13 08:09:21 +01:00
Azat Khuzhin
1df2a5a69e test: enable allocator_may_return_null=1 for calloc with ENOMEM test 2023-02-12 21:55:40 +01:00
Azat Khuzhin
207ea62bf9 test: handle -v as --verbose for regress 2023-02-12 21:55:40 +01:00
Azat Khuzhin
0ea2058252 test: add del_wait/del_notify tests for windows
Test manually, since CI is too slow
2023-02-12 21:54:45 +01:00
Azat Khuzhin
c437b84adb Remove extra builds for autotools on CI
We have almost the same matrix for cmake and autotools, but autotools is
considered to be deprecated from now on, plus our CI takes too much
time, especially non-linux, since we are using public infrastucture.

So let's remove extra builds.
2023-02-12 16:30:03 +01:00
Azat Khuzhin
f7e39d2e9b ci: bump cache and checkout plugins 2023-02-12 16:30:03 +01:00
Azat Khuzhin
b5a6940df2 ci: fix paths-ignore 2023-02-12 16:30:03 +01:00
Azat Khuzhin
7e6d9b0b17 .github/workflows/build.yml: remove trailing whitespaces 2023-02-12 16:30:03 +01:00
Azat Khuzhin
866b751b71 Deprecate autotools build 2023-02-12 16:30:03 +01:00
Edoardo Lolletti
765fb4108d
Fix compilation on non recent windows SDKs (#1399)
In commit f8bb9d8 the header stringapiset.h was included, very likely because the user who made the change saw that the funciton WideCharToMultiByte is "declared" in there.
That header tho is a recent addition to the windows headers added in the last years in an attempt from microsoft to split the windows.h header in multiple files, so the inclusion fails when the library is not built with the latest visual studio using the latest windows 10 sdk.
That inclusion can be safely removed as in any case the function WideCharToMultiByte was already included by the windows.h header that is included few lines below.
2023-02-12 16:19:35 +01:00
Azat Khuzhin
61de8a07c5
test: fix leaks in bufferevent_pair_release_lock (#1413) 2023-02-12 15:47:16 +01:00
Azat Khuzhin
a82b77bbc7 Remove suppression for test_ok under TSan
There is no such tests yet.
2023-02-12 11:27:28 +01:00
Azat Khuzhin
b5a5fbb81d Merge branch 'tests-fixes'
* tests-fixes:
  Add more ignore rules
  test: fix debug locks in case new lock gots old address
  test: suppress logs from the tests that produce them under normal circumstances
  test: fix TT_* flags values
  Suppress data race for test_ok variable
  Suppress data race for event_debug_created_threadable_ctx_ variable
2023-02-12 08:50:05 +01:00
Azat Khuzhin
b99106f3fd Add more ignore rules
- for clangd
- and compile_commands.json for it
2023-02-12 08:49:53 +01:00
Azat Khuzhin
c257e16f5b test: fix debug locks in case new lock gots old address
Refs: #1407
2023-02-12 08:49:47 +01:00
Azat Khuzhin
fb900a284f test: suppress logs from the tests that produce them under normal circumstances 2023-02-12 08:39:20 +01:00
Azat Khuzhin
1201bb8529 test: fix TT_* flags values 2023-02-12 08:39:00 +01:00
Azat Khuzhin
f0cb4b7f57 Suppress data race for test_ok variable 2023-02-12 08:39:00 +01:00
Azat Khuzhin
39be38ff79 Suppress data race for event_debug_created_threadable_ctx_ variable 2023-02-12 08:39:00 +01:00
Edoardo Lolletti
f9134df7d0
Add LEV_OPT_BIND_IPV4_AND_IPV6 flag (#1400)
Libevent introduced the LEV_OPT_BIND_IPV6ONLY to pass to evconnlistener_new_bind to make it automatically set the underlying socket as accepting ipv6 requests. This works fine on posix compliant platforms as by the standard every new AF_INET6 socket is created as both supporting ipv6 and ipv4 connections. But on windows the default is the opposite, with the flag IPV6_V6ONLY  being always enabled by default.

This makes creating a listener to supports both protocols a bit more tricky as winsock doesn't allow changing this flag after evconnlistener_new_bind does all the initial setup because as stated in the docs, you can't change it after the sonnect connected, so one would have to manually create the socket beforehand and set the flag and then call evconnlistener_new with the socket itself.

It would be nice to have libevent keep a consistent behaviour across the platforms in this scenario, maybe or by making it always set IPV6_V6ONLY  to false unless LEV_OPT_BIND_IPV6ONLY is passed, in which case it's set to true, or add another flag to forcefully set it to false and keep the system dependent behaviour as default.

So this patch add new option for libevent listeners to bind to both - LEV_OPT_BIND_IPV4_AND_IPV6
2023-02-04 15:00:48 +01:00
Azat Khuzhin
a5b0ded3c9 Add config for vim/nvim 2023-02-04 14:56:53 +01:00
Azat Khuzhin
4d85d28acd Fix pthread detection for regress tests on Android
Fixes: #1403
2023-01-28 13:28:52 +01:00
Azat Khuzhin
35375101e7 Fixes some new warnings under clang-15
- -Wdeprecated-non-prototype

  /src/le/libevent/strlcpy.c:48:1: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  event_strlcpy_(dst, src, siz)

- -Wstrict-prototypes

  /src/le/libevent/evthread.c:82:70: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
  struct evthread_condition_callbacks *evthread_get_condition_callbacks()

- -Wunused-but-set-variable

  /src/le/libevent/test/regress_buffer.c:130:6: warning: variable 'n' set but not used [-Wunused-but-set-variable]
          int n = 0;
                                                                     ^
2023-01-27 08:58:51 +01:00
Azat Khuzhin
3d138bda11 Allow evdns_base_new to succeed with no nameservers configured (#1389)
* evdns-no-ns:
  Allow evdns_base_new to succeed with no nameservers configured
  Replace magic numbers with consts for evdns_base_resolv_conf_parse() errors
2023-01-27 08:51:56 +01:00
Daniel Kempenich
ebd7e8d793 Allow evdns_base_new to succeed with no nameservers configured
If resolv.conf has no nameservers, evdns_base_new can still succeed with
the default of using the name server from localhost matching the man
page documentation for resolv.conf.
2023-01-27 08:50:29 +01:00