Skip to content

fix(H5Zdeflate): suppress C4267 warning#6411

Open
hyoklee wants to merge 3 commits into
developfrom
hyoklee-patch-1
Open

fix(H5Zdeflate): suppress C4267 warning#6411
hyoklee wants to merge 3 commits into
developfrom
hyoklee-patch-1

Conversation

@hyoklee
Copy link
Copy Markdown
Member

@hyoklee hyoklee commented May 19, 2026

On MSVC ARM64, size_t is 64-bit while zlib's uLong is 32-bit,
causing C4267 (conversion from 'size_t' to 'uLong', possible loss of data).

…r compressBound

On MSVC ARM64, size_t is 64-bit while zlib's uLong is 32-bit, causing C4267 (conversion from 'size_t' to 'uLong', possible loss of data).
Comment thread src/H5Zdeflate.c
size_t z_dst_nbytes = z_dst_buf_size;
#else
uLongf z_dst_buf_size = (uLongf)compressBound(nbytes);
uLongf z_dst_buf_size = (uLongf)compressBound((uLong)nbytes);
Copy link
Copy Markdown
Collaborator

@jhendersonHDF jhendersonHDF May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A check should be added to make sure that casting nbytes to uLong doesn't actually lose data

if ((size_t)(uLong)nbytes != nbytes)
    error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

3 participants