summaryrefslogtreecommitdiff
path: root/read.c
AgeCommit message (Collapse)Author
2020-06-07sdsrange overflow fix (#830)Michael Grunder
Fix overflow bug in `sdsrange`
2020-05-22Allow users to replace allocator and handle OOM everywhere. (#800)Michael Grunder
* Adds an indirection to every allocation/deallocation to allow users to plug in ones of their choosing (use custom functions, jemalloc, etc). * Gracefully handle OOM everywhere in hiredis. This should make it possible for users of the library to have more flexibility in how they handle such situations. * Changes `redisReaderTask->elements` from an `int` to a `long long` to prevent a possible overflow when transferring the task elements into a `redisReply`. * Adds a configurable `max elements` member to `redisReader` that defaults to 2^32 - 1. This can be set to "unlimited" by setting the value to zero.
2020-05-21Add logic to handle RESP3 push messages (#819)Michael Grunder
Fixes #815
2020-05-19Resp3 verbatim string support (#805)Michael Grunder
Pull RESP3 verbatim string handling from Redis Fixes #802
2020-05-04Remove nested depth limitation. (#797)Michael Grunder
* Remove nested depth limitation. This commit removes the nested multi-bulk depth limitation of 7. We do this by switching to pointer to pointer indirection and growing the stack in chunks when needed. See: #794, #421
2020-01-01fix spelling mistakesShooterIT
2019-08-28Fix MSVC build.Yossi Gottlieb
2019-08-27Merge pull request #697 from yossigo/resp3Mark Nunberg
Port RESP3 support from Redis.
2019-08-09Merge branch 'master' into createArray-size_tMark Nunberg
2019-08-04RESP3 support changes from Redis.Yossi Gottlieb
This corresponds to commits d5c54f0b..bea09a7f in the redis repository.
2019-08-04Initial RESP3 support [d5c54f0b].Yossi Gottlieb
2019-05-30redisReaderGetReply leak memoryqi.yang
2018-09-24Make string2ll static to avoid conflict with redisTom Lee
See discussion on #609. This should also make it easier for redis to update the vendored/bundled hiredis (though not by much).
2018-05-21Update createArray to take size_tJustin Brewer
This makes createArray consistent with createString, which also takes size_t. Bounds-check and unit tests are updated to allow up to min(SIZE_MAX,LLONG_MAX). Changelog is updated to mention this API break. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-05-20Use string2ll from Redismichael-grunder
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-20Fix bulk and multi-bulk length truncationJustin Brewer
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-19Properly detect integer parse errorsJustin Brewer
Badly formatted or out-of-range integers are now protocol errors. Signed-off-by: Justin Brewer <jzb0012@auburn.edu>
2018-04-30Remove redundant NULL checksJustin Brewer
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-30Remove redundant zero storesJustin Brewer
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-01-05calloc param fixes and NULL checkcdliuqiang@gmail.com
2016-04-11Update read.cDongwenHuang
static char *seekNewline(char *s, size_t len) : this function can not parse the string,such as "hello world\r". the case that the last char is '\r'.
2015-03-13Added support for compiling the parser code with Microsoft Visual C compiler.tzickel
For hiredis-py and others support on windows.
2015-01-05Refactor reading code into read.ctzickel
Makes hiredis reading functions easier to include in external projects [fixed all merge conflicts against current version] Closes #249