Skip to content

Commit

Permalink
Fix compression of serialized objects.
Browse files Browse the repository at this point in the history
Due to commit 0f5550e, compressing a
serialized object provided an inappropriate size to `s_compress_value()`
which will eventually lead to a segfault during compression. Provide the
the previously computed length instead.
  • Loading branch information
Vincent Bernat committed Jan 8, 2014
1 parent 3d324df commit f794ebe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion php_memcached.c
Expand Up @@ -3266,7 +3266,7 @@ char *php_memc_zval_to_payload(zval *value, size_t *payload_len, uint32_t *flags
/* If we have compression flag, compress the value */ /* If we have compression flag, compress the value */
if (MEMC_VAL_HAS_FLAG(*flags, MEMC_VAL_COMPRESSED)) { if (MEMC_VAL_HAS_FLAG(*flags, MEMC_VAL_COMPRESSED)) {
/* status */ /* status */
*payload_len = Z_STRLEN_P(value); *payload_len = pl_len;
payload = s_compress_value (compression_type, pl, payload_len, flags TSRMLS_CC); payload = s_compress_value (compression_type, pl, payload_len, flags TSRMLS_CC);
} }


Expand Down

0 comments on commit f794ebe

Please sign in to comment.