Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0884-zlib-Fix-negative-Adler32-checksums.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0884-zlib-Fix-negative-Adler32-checksums.patch of Package erlang
From 5d7e400b7a37561a5f11564cac81505d456910ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Mon, 16 Oct 2023 10:39:17 +0200 Subject: [PATCH] zlib: Fix negative Adler32 checksums --- erts/emulator/nifs/common/zlib_nif.c | 4 ++-- lib/kernel/test/zlib_SUITE.erl | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/erts/emulator/nifs/common/zlib_nif.c b/erts/emulator/nifs/common/zlib_nif.c index 2b8b691e11..92df1f48e1 100644 --- a/erts/emulator/nifs/common/zlib_nif.c +++ b/erts/emulator/nifs/common/zlib_nif.c @@ -472,7 +472,7 @@ static ERL_NIF_TERM zlib_codec(int (*codec)(z_stream*, int), } return enif_make_tuple3(env, am_need_dictionary, - enif_make_int(env, d->s.adler), flushed_output); + enif_make_ulong(env, d->s.adler), flushed_output); } } @@ -669,7 +669,7 @@ static ERL_NIF_TERM zlib_deflateSetDictionary(ErlNifEnv *env, int argc, const ER checksum = adler32(0, bin.data, bin.size); } - return enif_make_int(env, checksum); + return enif_make_ulong(env, checksum); } return zlib_return(env, res); diff --git a/lib/kernel/test/zlib_SUITE.erl b/lib/kernel/test/zlib_SUITE.erl index 4c7af0d6ef..0b8af8c4c4 100644 --- a/lib/kernel/test/zlib_SUITE.erl +++ b/lib/kernel/test/zlib_SUITE.erl @@ -49,7 +49,7 @@ chunk_bench_zeroed/1, chunk_bench_rand/1]). %% Others --export([smp/1, otp_9981/1, otp_7359/1]). +-export([smp/1, otp_9981/1, otp_7359/1, checksum/1]). -define(m(Guard, Expression), fun() -> @@ -72,7 +72,8 @@ all() -> [{group, api}, {group, examples}, {group, func}, {group, bench}, smp, otp_9981, - otp_7359]. + otp_7359, + checksum]. groups() -> [{api, [], @@ -1186,6 +1187,17 @@ otp_9981(Config) when is_list(Config) -> Ports = lists:sort(erlang:ports()), ok. +%% ERIERL-994: the Adler32 checksum returned by the dictionary functionality +%% could be negative due to returning a signed instead of unsigned integer. +checksum(Config) when is_list(Config) -> + Z = zlib:open(), + ok = zlib:deflateInit(Z), + TestVec = list_to_binary(lists:duplicate(16, 255)), + Chk = zlib:deflateSetDictionary(Z, TestVec), + true = Chk >= 0, + zlib:close(Z), + ok. + -define(BENCH_SIZE, (16 bsl 20)). -define(DECOMPRESS_BENCH(Name, What, Data), -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor