Skip to content

Commit 8456663

Browse files
committed
fix: disable dcz encoding when dictionary loading fails
1 parent 5637d45 commit 8456663

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

zstd.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx)
12981298
char *dict = PHP_ZSTD_G(output_compression_dict);
12991299

13001300
if (!dict || strlen(dict) <= 0) {
1301+
PHP_ZSTD_G(compression_coding) &= ~PHP_ZSTD_ENCODING_DCZ;
13011302
return NULL;
13021303
}
13031304

@@ -1307,6 +1308,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx)
13071308
NULL, context);
13081309
if (!stream) {
13091310
ZSTD_WARNING("could not open dictionary stream: %s", dict);
1311+
PHP_ZSTD_G(compression_coding) &= ~PHP_ZSTD_ENCODING_DCZ;
13101312
return NULL;
13111313
}
13121314

@@ -1320,6 +1322,7 @@ php_zstd_output_handler_load_dict(php_zstd_context *ctx)
13201322
php_stream_close(stream);
13211323

13221324
if (!data) {
1325+
PHP_ZSTD_G(compression_coding) &= ~PHP_ZSTD_ENCODING_DCZ;
13231326
return NULL;
13241327
}
13251328

0 commit comments

Comments
 (0)