Commit Graph
3870 Commits
Author SHA1 Message Date
Evgeny Grin (Karlson2k) 4273eea6d4 test_postprocessor: added more cases for urlencoding 2021-09-15 15:16:07 +03:00
Evgeny Grin (Karlson2k) a7cdb394f2 Missing part of cec8013b70 2021-09-15 15:16:07 +03:00
Evgeny Grin (Karlson2k) cec8013b70 test_postprocessor: integrated one check into unified testing 2021-09-15 14:14:15 +03:00
Evgeny Grin (Karlson2k) 292b565629 test_postprocessor: test urlencoding more thoroughly 2021-09-15 13:57:21 +03:00
Evgeny Grin (Karlson2k) bbc57f9386 postprocessor: fixed empty key processing 2021-09-15 13:32:47 +03:00
Evgeny Grin (Karlson2k) ba63b33aea postprocessor: added asserts 2021-09-15 13:31:49 +03:00
Evgeny Grin (Karlson2k) 368991b0ee postprocessor: do not try to process value or key if state is 'error' 2021-09-15 12:11:22 +03:00
Evgeny Grin (Karlson2k) f032145edc test_postprocessor: added check with empty key 2021-09-15 11:48:20 +03:00
Evgeny Grin (Karlson2k) c37cf71908 Updated copyright year in W32 .DLL files resources 2021-09-15 11:47:25 +03:00
Evgeny Grin (Karlson2k) b6dbca7699 Moved some logic from 'configure' to 'mhd_align.h'
This should improve readability and maintainability of the code.
2021-09-13 21:00:54 +03:00
Evgeny Grin (Karlson2k) a066a34138 mhd_align.h: fixed copy-paste error
Alignment of uint64_t was incorrect
2021-09-13 19:14:39 +03:00
Evgeny Grin (Karlson2k) b5de085bf1 test_postprocessor: fixed strlen() with NULL 2021-09-12 20:01:54 +03:00
Evgeny Grin (Karlson2k) 1e314fd50a postprocessor: use NULL for 'data' for callback if no value is present 2021-09-12 19:44:13 +03:00
Evgeny Grin (Karlson2k) 7a6a9d14a4 postprocessor: minor optimization: do not process zero-length data 2021-09-12 19:31:45 +03:00
Evgeny Grin (Karlson2k) e724878002 postprocessor: do not call memcpy() / memmove() with zero size 2021-09-12 19:31:44 +03:00
Evgeny Grin (Karlson2k) 6c2f3cf24f postprocessor: fixed undefined behavior error
memcpy() must be called with valid pointers even if size is zero.
Sanitizer doesn't like 'zero pointer with zero offset' as well.
2021-09-12 19:31:44 +03:00
Evgeny Grin (Karlson2k) 4017f5a3ed postprocessor: added asserts in process_value() 2021-09-12 19:31:44 +03:00
Evgeny Grin (Karlson2k) bf6be24be3 test_postprocessor: fixed call of memcmp() with NULL pointers 2021-09-12 19:28:10 +03:00
Evgeny Grin (Karlson2k) ce7e1e50d3 test_postprocessor: catch impossible value 2021-09-11 14:19:47 +03:00
Evgeny Grin (Karlson2k) e7b2a95ce2 test_postprocessor: improved code readability
Robustness is improved as well as a side-effect
2021-09-11 14:19:03 +03:00
Evgeny Grin (Karlson2k) 706a156f9e test_postprocessor: fixed printf() called with NULL pointer 2021-09-11 13:19:57 +03:00
Evgeny Grin (Karlson2k) aa6b811d8d test_postprocessor: added checks for returned values 2021-09-10 22:39:38 +03:00
Evgeny Grin (Karlson2k) a9a6c02e7b memorypool: mute sanitizer errors
Avoid using even temporal pointer values out of allocated area
2021-09-08 15:26:34 +03:00
Evgeny Grin (Karlson2k) f247a26b23 test_quiesce_stream: fixed
Use public macro for value.
2021-09-07 21:06:32 +03:00
Evgeny Grin (Karlson2k) 9d7457a50d microhttpd.h: changed macros MHD_CONTENT_READER_*
Macros are used with ssize_t values and described in doxy as "-1" and "-2"
Let's define them as described.
2021-09-07 21:00:34 +03:00
Evgeny Grin (Karlson2k) b9a1777c15 Fixed analyzer errors: cast enum values to enum types.
enum values in C are not enum types, they are just numbers. By default
numbers are mapped to signed type, like 'int'.
enum types are represented with usigned types, like 'unsigned int', unless
values of enum contains negative numbers.
If bitwise NOT performed on pure enum value, which is automatically
mapped to 'int', then result is negative number. Result of casting of
negative number to unsigned type depends on architecture and may be
unexpected.
By explicitly casting enum values to enum types, values are converted
to correct representation type, like 'unsgined int'. Result of
bitwise NOT for unsigned type is predictable and does not need to
be casted to the final type.

Yes, casting of enum values to the same enum type looks strange, but this
is the only way to properly handle bitwise NOT for enums in C.
2021-09-07 20:41:28 +03:00
Evgeny Grin (Karlson2k) 6210a78fed configure: spelling fixes 2021-09-07 13:33:34 +03:00
Evgeny Grin (Karlson2k) af4f8885f4 mhd_str: rewrote one function to stop sanitizer alarming
The function was rewritten to use arrays with indexes instead of pointers.
Address Sanitizer produced error because pointers may reach value beyond
allocated range. Despite the fact that such pointers are never dereferenced
comparison of them produced false-positive errors.
As a side effect, readability was improved a bit.
2021-09-07 13:33:34 +03:00
Evgeny Grin (Karlson2k) 7345c1498b Fix for e2a52a91c6
Moved 'dnl' to the right place
2021-09-07 12:33:29 +03:00
Evgeny Grin (Karlson2k) e2a52a91c6 configure: improved test for undefined behavior sanitizer
Added workaround for clang bug
2021-09-07 12:25:26 +03:00
Evgeny Grin (Karlson2k) be630f9d6b configure: reset CFLAGS when testing for sanitizers 2021-09-07 12:25:25 +03:00
Evgeny Grin (Karlson2k) 12771c10bf configure: use CFLAGS only one time when testing for sanitizers 2021-09-07 12:25:25 +03:00
Evgeny Grin (Karlson2k) 41b139afea Revert 73c37e06b1
It does not solve the problem with sanitizer
2021-09-06 10:39:43 +03:00
Evgeny Grin (Karlson2k) 73c37e06b1 mhd_str: silent sanitizer false-positive error 2021-09-05 18:20:19 +03:00
Evgeny Grin (Karlson2k) dc802aa5ea MHD_start_daemon_va (): fixed sanitizer error 2021-09-05 17:54:16 +03:00
Evgeny Grin (Karlson2k) 2646f3a681 sha*/md5: fixed implicit value conversion
Performance may be improved as a side effect
2021-09-05 17:39:09 +03:00
Evgeny Grin (Karlson2k) 9d3187cfc1 .gitlab-ci: added "keep-going" for "check" jobs 2021-09-05 15:31:41 +03:00
Evgeny Grin (Karlson2k) 5acd08c5c6 .gitlab-ci: use project's built-in support for sanitizers 2021-09-05 15:08:03 +03:00
Evgeny Grin (Karlson2k) 82985cc023 .gitlab-ci: added quoting for variables 2021-09-05 15:01:29 +03:00
Evgeny Grin (Karlson2k) 169cd95f9e Added more options for undefined behavior sanitizer
* Added ability to use sanitizer on systems without run-time UBSan library
2021-09-05 14:46:03 +03:00
Evgeny Grin (Karlson2k) 75dc9e0312 Reworked support for sanitizers
* Check whether sanitizers can be really used
* Added support for new sanitizers
* Added more thorough run-time checking
* Better reporting
2021-09-05 12:36:46 +03:00
Christian Grothoff fdfd5dc80f tbrehm@dspace.de wrote:
Hi,

gcc10 complains with two warnings when compiling libmicrohttpd using

    #define NDEBUG 1
    #define DAUTH_SUPPORT 1

so, "release build" with enabled "digest authentication":

../digestauth.c: In function 'MHD_digest_auth_check_digest2':
../digestauth.c:1287:9: warning: 'da.digest_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1287 |   if (da.digest_size != digest_size)
      |       ~~^~~~~~~~~~~~
../digestauth.c: In function 'MHD_queue_auth_fail_response2':
../digestauth.c:1361:55: warning: 'da.digest_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1361 |     char nonce[NONCE_STD_LEN (VLA_ARRAY_LEN_DIGEST (da.digest_size)) + 1];
      |

This is a minor issue, without any practical effect, unless when calling the MHD API with an invalid value for the MHD_DigestAuthAlgorithm enum.
However, gcc is still right that there is a potential code path with undefined behaviour: the default-case in the switch statement in SETUP_DA does not set "da.digest_size".
Two functions later still always read this value. And the "mhd_assert" has no effect, since it's disabled when NDEBUG is set.

Trivial patch attached to silence the compiler warnings by also initializing "da.digest_size" in the default case of the switch statement:
2021-09-03 13:31:05 +02:00
Evgeny Grin (Karlson2k) 201444ffb1 Improved 'configure' report after e163ad95a7 2021-09-02 16:11:26 +03:00
Evgeny Grin (Karlson2k) e163ad95a7 Disabled parallel make for curltest if heavy tests are enabled 2021-09-02 16:09:34 +03:00
Evgeny Grin (Karlson2k) 849b9eebc1 configure: limit number of CPU cores used without heavy testing 2021-09-02 16:08:35 +03:00
Evgeny Grin (Karlson2k) f602bab6f6 mhd_limits.h: removed wrong alternative for SSIZE_MAX 2021-09-02 14:59:16 +03:00
Evgeny Grin (Karlson2k) 7be09c4512 Fixed possible preprocessor error if ULLONG_MAX is not digits-only 2021-09-02 14:58:10 +03:00
Evgeny Grin (Karlson2k) d8cc7c50f0 mhd_limits.h: fixed copy-paste error in comment 2021-09-02 14:57:17 +03:00
Evgeny Grin (Karlson2k) 6b83caccb3 mhd_limits.h: use alternative name for ULLONG_MAX if available 2021-09-02 14:56:37 +03:00
Evgeny Grin (Karlson2k) 9f333edbdf Fixed possible preprocessor error when SIZE_MAX is not digits-only 2021-09-02 10:45:38 +03:00