Commit Graph

630 Commits

Author SHA1 Message Date
Mark Nunberg
67036ef70c
Merge pull request #578 from mnunberg/connfix
Proper error reporting for connect failures
2018-10-03 06:53:42 -04:00
Mark Nunberg
747d78beaa
Merge pull request #580 from charsyam/feature/fix-realloc
fix common realloc mistake and add null check more
2018-09-27 07:07:00 -04:00
Mark Nunberg
273fae1dea
Merge pull request #614 from thomaslee/tom_cppflags
Add CPPFLAGS to REAL_CFLAGS
2018-09-26 22:35:38 -04:00
Tom Lee
3bcf286356 Add CPPFLAGS to REAL_CFLAGS 2018-09-26 13:25:24 -07:00
michael-grunder
fbf2d037e7 Update changelog for 0.14.0 2018-09-26 12:17:25 -07:00
Mark Nunberg
3cb4fb2395 Skip NXDOMAIN test when using evil ISPs
Some ISPs like to inject their own "Suggestions" page whenever you hit
NXDOMAIN. This confuses Redis as well as addrinfo (black-holing the
route).
2018-09-25 20:51:34 -04:00
Mark Nunberg
cbe4ae63ae Handle connection errors better in blocking mode as well 2018-09-25 20:21:40 -04:00
Mark Nunberg
5e6bbf8c60 saddr should be addrlen bytes
Not sizeof saddr.
2018-09-25 20:21:40 -04:00
Mark Nunberg
49974c9359 Call connect(2) again for non-blocking connect
This retrieves the actual error which occurred, as getsockopt is not
always reliable in this regard.
2018-09-25 20:21:37 -04:00
Mark Nunberg
685030652c
Merge pull request #612 from thomaslee/tom_release_prep
Prepare for the 0.14.0 release
2018-09-25 18:59:34 -04:00
Tom Lee
29c82b728c Prepare for the 0.14.0 release
SONAME bumped to 0.14 because we've broken ABI compatibility with 0.13.x
2018-09-25 15:48:07 -07:00
Mark Nunberg
d153c1f3c0
Merge pull request #610 from thomaslee/tom_static_string2ll
Make string2ll static to avoid conflict with redis
2018-09-24 20:43:33 -04:00
Tom Lee
c3188bfb1f Make string2ll static to avoid conflict with redis
See discussion on #609. This should also make it easier for redis to
update the vendored/bundled hiredis (though not by much).
2018-09-24 16:14:08 -07:00
Ryan Schmidt
a65537a672 Use -dynamiclib instead of -shared on macOS
-dynamiclib is the correct documented flag to use to create dynamic
libraries on macOS. Newer toolchains recognize -shared as a synonym
of -dynamiclib but older toolchains don't.
2018-05-31 02:52:45 -05:00
Justin Brewer
967027c881 Add Changelog entry about the integer parsing changes
This should have been included in
93421f9d84 but was missed.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-05-21 09:40:42 -07:00
michael-grunder
33a36dc25b Don't overflow 32 bit machines in the tests! 2018-05-20 12:34:20 -07:00
michael-grunder
60f622b892 Add an integer parsing heavy workload to throughput testing 2018-05-20 11:57:21 -07:00
michael-grunder
7bef042c03 Use string2ll from Redis
This commit pulls string2ll from Redis (with permission from Antirez)
as strtoll is 2-3x slower and even worse vs the original version in
hiredis that didn't check for overflow at all.

By using string2ll there is almost no measurable performance impact
of overflow detection even in integer parsing heavy workloads (e.g.
INCRBY commands).
2018-05-20 10:44:19 -07:00
Justin Brewer
1091975857 Fix bulk and multi-bulk length truncation
processMultiBulkItem truncates the value read from readLongLong,
resulting in a corrupted state when the next item is read.
createArray takes an int, so bound to INT_MAX.

Inspection showed that processBulkItem had the same truncation issue.
createString takes size_t, so bound to SIZE_MAX. This only has an
effect on 32-bit platforms.

A strict lower bound is also added, since negative lengths other
than -1 are invalid according to RESP.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-05-20 09:07:21 -07:00
Justin Brewer
93421f9d84 Properly detect integer parse errors
Badly formatted or out-of-range integers are now protocol errors.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-05-19 10:48:14 -07:00
michael-grunder
dbde4f68cf Merge branch 'master' of github.com:redis/hiredis 2018-05-16 09:57:40 -07:00
michael-grunder
9d3b4ec703 Make sure we've got a path separator before the actual dylib name 2018-05-16 09:08:00 -07:00
michael-grunder
03938d7ad2 Merge remote-tracking branch 'ryandesign/install_name' 2018-05-16 09:01:21 -07:00
Michael Grunder
c5cb456421
Merge pull request #596 from ryandesign/cp-pPR
Use cp -pPR instead of cp -a
2018-05-15 18:16:12 -07:00
Ryan Schmidt
0e9af8acb6
Use cp -pPR instead of cp -a
This should be equivalent but compatible with older versions of cp.
2018-05-14 17:37:14 -05:00
Ryan Schmidt
881fcb776d
Use absolute install_name
Fixes #437.
2018-05-14 14:32:05 -05:00
michael-grunder
7a1acdfeb5 Merge remote-tracking branch 'justinbrewer/hiredis-pr1' into posix-build-fixes 2018-05-13 18:08:57 -07:00
michael-grunder
c1af0e849d Attempted fix for Cygwin to expose getaddrinfo and friends 2018-05-09 21:13:01 -07:00
michael-grunder
fbc4971d7d Merge remote-tracking branch 'hyjin/master' 2018-05-09 16:37:00 -07:00
Justin Brewer
58e6b87f51 Remove redundant NULL checks
free(NULL) is a valid NOP. Most of the hiredis free functions behave the
same way. redisReaderFree is updated to also be NULL-safe.

There is one redundant NULL check at sds.c:1036, but it's left as is
since sds is imported from upstream.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30 21:45:13 -05:00
Justin Brewer
54acc8f087 Remove redundant zero stores
calloc is guaranteed to provide a zero-initialized buffer. There is
no need to set fields to zero explicitly.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30 21:45:13 -05:00
Justin Brewer
546d9415e1 Fix a segfault on *BSD
freeaddrinfo is not required by POSIX to be NULL-safe. OpenBSD will
SIGSEGV. NetBSD will assert. FreeBSD up to 11.1 will SIGSEGV, while in
future versions, it will be a silent NOP [1].

Commit d4b715f0aa ("Fix potential race in 'invalid timeout' tests")
added a code path to _redisContextConnectTcp which calls
freeaddrinfo(NULL), triggering the segfault. Put a NULL check around the
call to freeaddrinfo.

[1] - e916723903

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30 21:45:13 -05:00
Justin Brewer
d1c1b668c1 Drop __redis_strerror_r
Since _GNU_SOURCE is now guaranteed to be unset, it is no longer
necessary to support the GNU-specific version of strerror_r.

Drop __redis_strerror_r from the header, and call strerror_r directly.
This breaks any external users of this macro, but they shouldn't have
been using it in  the first place.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30 21:45:13 -05:00
Justin Brewer
49bbaacc79 Strip down fmacros.h
strerror_r and addrinfo require _POSIX_C_SOURCE >= 200112L,  which is
implied by _XOPEN_SOURCE >= 600. With the removal of AF_LOCAL usage,
the only non-standard features being used are the TCP_KEEP* socket
flags. _DARWIN_C_SOURCE is required to expose TCP_KEEPALIVE.

Fall back to using _XOPEN_SOURCE 600 for all platforms, and
additionally define _DARWIN_C_SOURCE for Darwin.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-28 16:35:40 -05:00
Justin Brewer
bbeab80090 Use AF_UNIX
AF_LOCAL is the old, non-standardized name for AF_UNIX. Just use
AF_UNIX, rather than wrestling with platform specifics of AF_LOCAL
definitions.

Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-28 16:35:38 -05:00
charsyam
471557c349 fix common realloc mistake and add null check more 2018-03-17 17:41:43 +09:00
not-a-robot[bot]
3d8709d19d Merge #569
569: Ibm aix fix r=badboy
2018-01-06 12:26:55 +00:00
Jan-Erik Rediger
952a33f298 Make it compile on IBM AIX systems
Closes #422
2018-01-06 13:25:35 +01:00
not-a-robot[bot]
a827f5a898 Merge #568
568: Make XOPEN_SOURCE definition explicit per architecture r=badboy

Fixes #441
2018-01-05 19:15:24 +00:00
Jan-Erik Rediger
94ed2e430b Make XOPEN_SOURCE definition explicit per architecture
Fixes #441
2018-01-05 16:20:34 +01:00
cdliuqiang@gmail.com
9219556386 calloc param fixes and NULL check 2018-01-05 16:19:54 +01:00
Jan-Erik Rediger
43284ee495
Merge pull request #561 from zshipko/master
Fix "make install" on OpenBSD
2018-01-05 15:50:31 +01:00
Jan-Erik Rediger
abc60433e6
Merge pull request #564 from dmvo/master
Remove $(ARCH) expansion from the Makefile
2018-01-05 15:49:51 +01:00
Dmitri Vorobiev
12a9d1a32b Strip compiler options from the CC variable
The Makefile checks validity of the compiler command in the CC
variable by feeding the contents of that variable to the `type'
utility. Some environments include compiler options in the CC
variable such as architecture specific tuning flags. For such
cases it is necessary to first strip everything except the
command itself from the contents of the CC variable prior to
checking the command with the type utility, which is what this
patch is introducing. We use shell parameter expansion mechanism
for this purpose.

Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>
2017-12-28 11:42:45 +02:00
Dmitri Vorobiev
3238cf4fe7 Remove $(ARCH) expansion from the Makefile
Some compilation environments (such as Yocto) define the ARCH
environment variable to indicate the target architecture. For
such enviroments, hiredis build fails, because the expanded
$(ARCH) variable in the Makefile gets erroneously interpreted
as an argument to the `-ggdb' command line option during the
compilation stage or as an input file name during the linking
stage.

This patch removes $(ARCH) expansions from the Makefile. This
doesn't harm cross-compilation, the latter goes fine with the
properly assigned CC environment variable. For native builds,
this patch does not imply any changes.

Signed-off-by: Dmitri Vorobiev <dmitri.vorobiev@movial.com>
2017-12-27 14:46:07 +02:00
Zach Shipko
a2ef2b69bf Fix "make install" on OpenBSD 2017-11-28 17:43:11 -08:00
not-a-robot[bot]
07d414731b Merge #554
554: build: do not assume that INSTALL is cp r=badboy

INSTALL is supposed to be `install` in most of the cases which
doesn't work with directories, but works perfectly with files.

Don't do this assumption.

Reported-by: Jiří Vymazal <jvymazal@redhat.com>
References: https://bugzilla.redhat.com/show_bug.cgi?id=1506251
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-11-07 08:26:51 +00:00
Jan-Erik Rediger
f861d9dc50 chore: Build only branches bors needs 2017-11-07 09:26:02 +01:00
Igor Gnatenko
725a96aaa2 build: do not assume that INSTALL is cp
INSTALL is supposed to be `install` in most of the cases which
doesn't work with directories, but works perfectly with files.

Don't do this assumption.

Reported-by: Jiří Vymazal <jvymazal@redhat.com>
References: https://bugzilla.redhat.com/show_bug.cgi?id=1506251
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2017-10-30 10:22:05 +01:00
Jan-Erik Rediger
43d92c59f3 Merge pull request #542 from EdwardBetts/spelling
correct spelling mistake
2017-09-01 20:47:20 +02:00