Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3a2694c4
Commit
3a2694c4
authored
Apr 29, 2009
by
antirez
Browse files
fix for the LZF off-by-one bug added
parent
b284af55
Changes
2
Show whitespace changes
Inline
Side-by-side
TODO
View file @
3a2694c4
BEFORE REDIS 1.0.0-rc1
BEFORE REDIS 1.0.0-rc1
- TTL command that returns -1 if a key is not volatile otherwise the time to live of a volatile key.
- Remove max number of args limit
- Remove max number of args limit
- What happens if the saving child gets killed instead to end normally? Handle this.
- What happens if the saving child gets killed instead to end normally? Handle this.
- Make sinterstore / unionstore / sdiffstore returning the cardinality of the resulting set.
- Make sinterstore / unionstore / sdiffstore returning the cardinality of the resulting set.
...
...
redis.c
View file @
3a2694c4
...
@@ -1704,7 +1704,7 @@ static int rdbSaveLzfStringObject(FILE *fp, robj *obj) {
...
@@ -1704,7 +1704,7 @@ static int rdbSaveLzfStringObject(FILE *fp, robj *obj) {
/* We require at least four bytes compression for this to be worth it */
/* We require at least four bytes compression for this to be worth it */
outlen = sdslen(obj->ptr)-4;
outlen = sdslen(obj->ptr)-4;
if (outlen <= 0) return 0;
if (outlen <= 0) return 0;
if
((
out
=
zmalloc
(
outlen
))
==
NULL
)
return
0
;
if ((out = zmalloc(outlen
+1
)) == NULL) return 0;
comprlen = lzf_compress(obj->ptr, sdslen(obj->ptr), out, outlen);
comprlen = lzf_compress(obj->ptr, sdslen(obj->ptr), out, outlen);
if (comprlen == 0) {
if (comprlen == 0) {
zfree(out);
zfree(out);
...
@@ -1741,7 +1741,7 @@ static int rdbSaveStringObject(FILE *fp, robj *obj) {
...
@@ -1741,7 +1741,7 @@ static int rdbSaveStringObject(FILE *fp, robj *obj) {
/* Try LZF compression - under 20 bytes it's unable to compress even
/* Try LZF compression - under 20 bytes it's unable to compress even
* aaaaaaaaaaaaaaaaaa so skip it */
* aaaaaaaaaaaaaaaaaa so skip it */
if
(
len
>
20
)
{
if (
1 &&
len > 20) {
int retval;
int retval;
retval = rdbSaveLzfStringObject(fp,obj);
retval = rdbSaveLzfStringObject(fp,obj);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment