Commit Graph

1011 Commits (master)

Author SHA1 Message Date
Björn Svensson 4021726a69 Add asynchronous test for pubsub using RESP2
The testcase will subscribe to a channel, and via a second client
a message is published to the channel. After receiving the message
the testcase will unsubscribe and disconnect.
2021-10-27 16:46:37 +02:00
Björn Svensson 648763c36e Add build options for enabling async tests
Asynchronous testcases that requires the event library `libevent`
can be built and enabled by using the added build flags:
- ENABLE_ASYNC_TESTS when using CMake
- TEST_ASYNC when using Make

The async tests are disabled by default to avoid adding new requirements,
but the testcases are built and run in CI.
2021-10-26 09:54:44 +02:00
Bjorn Svensson c98c6994de
Correcting the build target `coverage` for enabled SSL (#1009)
* Exclude includes from /usr in coverage reporting

* Correct build target `coverage` for enabled ssl

`USE_SSL=1 make coverage` will now build the test binary with the
forwarded define HIREDIS_TEST_SSL. This avoids inconsistency between
built test binary and the testrunner `test.sh`.
This enables test coverage measurements for SSL too.
2021-10-21 13:17:21 -07:00
Björn Svensson 30ff8d850e Run SSL tests in CI 2021-10-20 12:55:24 -07:00
michael-grunder 4a126e8a9c Add valgrind and CMake to tests 2021-10-14 11:40:00 -07:00
michael-grunder b73c2d410f Add Centos8
I'm sure this can be done with a container matrix but figuring that out
is left for another day.
2021-10-12 14:14:03 -07:00
michael-grunder e9f6473845 We should run actions on PRs 2021-10-12 13:31:02 -07:00
michael-grunder 6ad4ccf3c7 Add Cygwin build test 2021-10-12 13:06:11 -07:00
michael-grunder 783a3789c2 Add Windows tests in GitHub actions
See: #992

TODO:  MinGW/cygwin tests
2021-10-10 14:24:58 -07:00
michael-grunder 0cac8dae1b Switch to GitHub actions
Since TravisCI.org was deprecated we've been without any tests.  This
commit adds back basic tests in Ubuntu, CentOS, and MacOS.

More sophisticated tests/platforms to come in the future (e.g. 32bit
tests).

See: #992
2021-10-10 13:18:01 -07:00
michael-grunder fa900ef76f Fix unused variable warning. 2021-10-10 11:58:19 -07:00
michael-grunder e489846b72 Minor refactor of CVE-2021-32765 fix.
Since `hi_calloc` always passes through one of our wrapper functions,
we can perform this overflow in the wrapper, and get protection
everywhere.

Previous commit: 76a7b10005

Related vuln ID: CVE-2021-32765
[Full Details](https://github.com/redis/hiredis/security/advisories/GHSA-hfm9-39pp-55p2)
2021-10-10 11:13:23 -07:00
Tongliang Liao 51c740824b Remove extra comma from cmake var.
Or it'll be treated as part of the var name.
2021-10-09 13:19:39 -07:00
michael-grunder 632bf07183 Merge branch 'release/v1.0.2' 2021-10-07 13:25:50 -07:00
michael-grunder b731283245 Prepare for v1.0.2 GA 2021-10-07 10:00:14 -07:00
michael-grunder d4e6f109a0 Revert erroneous SONAME bump 2021-10-07 09:48:08 -07:00
michael-grunder a39824a5df Merge branch 'release/v1.0.1'
Merge the v1.0.1 release branch and bump the dev version to 1.0.2-dev
2021-10-04 13:35:10 -07:00
michael-grunder 8d1bfac464 Prepare for v1.0.1 GA 2021-10-04 13:08:51 -07:00
Yossi Gottlieb 76a7b10005 Fix for integer/buffer overflow CVE-2021-32765
This fix prevents hiredis from trying to allocate more than `SIZE_MAX`
bytes, which would result in a buffer overrun.

[Full Details](https://github.com/redis/hiredis/security/advisories/GHSA-hfm9-39pp-55p2)
2021-10-04 11:56:31 -07:00
Yunier Perez 9eca1f36f4 Allow to override OPENSSL_PREFIX in Linux 2021-10-03 10:58:27 -07:00
rouzier 2d9d77518d
Don't leak memory if an invalid type is set (#906)
Co-authored-by: James Rouzier <jrouzier@inverse.ca>
2021-08-18 19:13:34 -07:00
Meir Shpilraien (Spielrein) f5f31ff9b9
Added REDIS_NO_AUTO_FREE_REPLIES flag (#962)
When set hiredis will not automatically free replies in an async context, and the replies must be freed instead by the user.

Co-authored-by: Michael Grunder <michael.grunder@gmail.com>
2021-07-11 11:26:20 -07:00
michael-grunder 5850a8ecd2 Ensure we curry any connect error to an async context. 2021-06-17 13:37:49 -07:00
michael-grunder b6f86f38c2 Fix README.md
Closes #929
2021-05-23 10:45:47 -07:00
Michael Grunder 667dbf5365
Merge pull request #935 from kristjanvalur/pr5
Bugfix: Ignore timeout callback from a successful connect (fixes #945)
2021-05-02 12:26:05 -07:00
Michael Grunder 9bf6c250e5
Merge pull request #939 from zmartzone/improve_pr_896_ssl_leak
improve SSL leak fix redis/hiredis#896
2021-05-02 11:49:48 -07:00
Michael Grunder 959af97609
Merge pull request #949 from plan-do-break-fix/Typo-corrections
fix(docs): corrects typos in project README
2021-05-02 11:29:52 -07:00
plan-do-break-fix 0743f57bba fix(docs): corrects typos in project README 2021-04-24 02:23:36 -05:00
Hans Zandbelt 5f4382247a improve SSL leak fix redis/hiredis#896
Free SSL object when redisSSLConnect fails but avoid doing that for
callers of redisInitiateSSL who are supposed to manager their own SSL
object.

Signed-off-by: Hans Zandbelt <hans.zandbelt@zmartzone.eu>
2021-04-11 18:49:38 +02:00
Kristján Valur Jónsson e06ecf7e45 Ignore timeout callback from a successful connect 2021-04-08 09:45:49 +00:00
michael-grunder dfa33e60b0 Change order independant push logic to not change behavior.
Since redisGetReplyFromReader is exposed in a header file, we probably
shouldn't modify how it behaves in any way.  For this reason, handle the
changed logic in an internal static helper method.
2021-04-02 09:34:09 -07:00
michael-grunder 6204182aae Handle the case where an invalidation is sent second.
RESP3 invalidation messages always seemed to be sent before the response
to a given command, but it appears this is not always the case:

In Redis 6.2.0RC1 Redis sends the invalidation after the HSET in the
following sequence:

```
hget hash field
$5
value
hset hash field value
:0
>2
$10
invalidate
*1
$4
hash
```

To account for this possibility just wrap redisGetReplyFromReader in a
loop as it is called twice in redisGetReply.
2021-04-02 09:34:09 -07:00
michael-grunder d6a0b192b4 Merge branch 'reader-updates'
Updates and improvements to the RESP3 protocol reader.

* Fix the unset len field when creating RESP3 double objects
* Fix RESP3 double infinity parsing
* Add additional validations when parsing various reply types
* Fix the parent type assertions in certain default reply object
  creation callbacks (mostly to include PUSH as a parent).
* Additional reader test cases
* Implement RESP3 BIGNUM support
* Refactor seekNewline() to use memchr()
2021-02-25 21:53:34 -08:00
michael-grunder 410c24d2a9 Fix off-by-one error in seekNewline 2021-02-25 21:25:17 -08:00
Alex Smith bd7488d27d read: Validate line items prior to checking for object creation callbacks 2021-02-25 21:25:17 -08:00
Alex Smith 5f9242a1f8 read: Remove obsolete comment on nested multi bulk depth limitation 2021-02-25 21:25:17 -08:00
Alex Smith 83c1450425 read: Add support for the RESP3 bignum type 2021-02-25 21:25:17 -08:00
Alex Smith c6646cb192 read: Ensure no invalid '\r' or '\n' in simple status/error strings 2021-02-25 21:25:17 -08:00
Alex Smith e43061156c read: Additional validation and test case for RESP3 double
This ensures that malformed RESP3 double messages that include an
invalid null byte are not parsed as valid.
2021-02-25 21:25:17 -08:00
Alex Smith c8adea4024 redisReply: Fix parent type assertions during double, nil, bool creation
Per RESP3, push messages are able to contain exactly what array
messages can contain (that is, any other type).
2021-02-25 21:25:17 -08:00
Alex Smith ff73f1f9e7 redisReply: Explicitly list nil and bool cases in freeReplyObject() switch. 2021-02-25 21:25:17 -08:00
Alex Smith 0f92518847 test: Add test case for RESP3 set 2021-02-25 21:25:17 -08:00
Alex Smith 33c06dd503 test: Add test case for RESP3 map 2021-02-25 21:25:17 -08:00
Alex Smith 397fe26301 read: Use memchr() in seekNewline() instead of looping over entire string 2021-02-25 21:25:17 -08:00
Alex Smith 81c48a9821 test: Add test cases for RESP3 bool 2021-02-25 21:25:17 -08:00
Alex Smith 51e693f4fd read: Add additional RESP3 bool validation
RESP3 bools should be only one of "#t\r\n" or "#f\r\n". We also allow
capital 'T' and 'F' to be lenient.
2021-02-25 21:25:17 -08:00
Alex Smith 790b4d3b4d test: Add test cases for RESP3 nil 2021-02-25 21:25:17 -08:00
Alex Smith d8899fbc19 read: Add additional RESP3 nil validation
RESP3 nil should consist of "_\r\n" and nothing else.
2021-02-25 21:25:17 -08:00
Alex Smith 96e8ea6110 test: Add test cases for infinite and NaN doubles 2021-02-25 21:25:17 -08:00
Alex Smith f913e9b997 read: Fix double validation and infinity parsing
The ',' protocol byte gets removed in processItem(), so it should not
be compared against in processLineItem().

strtod() allows multiple representations of infinity and NaN that are
not RESP3 compliant. Since we explicitly check for the two compliant
infinity cases, strtod() should only return finite values.
2021-02-25 21:25:17 -08:00