Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stack size warning in cdeflate.c #435

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

derobins
Copy link
Member

Converts a giant stack array to a dynamically-allocated array.

Also removes these internal symbols from cdeflate.h (which is public):

  • DEFLATE_BUF_SIZE
  • DEFLATE_TMP_BUF_SIZE

Converts a giant stack array to a dynamically-allocated array.

Also removes these internal symbols from cdeflate.h (which is public):
* DEFLATE_BUF_SIZE
* DEFLATE_TMP_BUF_SIZE
@derobins derobins added Component - C Library Core C library issues Type - Improvement Improvements that don't add a new feature or functionality Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. labels Sep 13, 2023

/* Allocate a temporary buffer for decompression */
if ((tmp_buf = (uint8 *)malloc(sizeof(uint8) * DEFLATE_TMP_BUF_SIZE)) == NULL)
HGOTO_ERROR(DFE_NOSPACE, FAIL);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the real change (everything else is tidying and adapting error handling to clean up memory)

@@ -27,10 +27,6 @@
#include "zlib.h"
#undef zintf

/* Define the [default] size of the buffer to interact with the file. */
#define DEFLATE_BUF_SIZE 4096
#define DEFLATE_TMP_BUF_SIZE 16384
Copy link
Member Author

Choose a reason for hiding this comment

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

These should not be public

@derobins derobins merged commit 58aef88 into HDFGroup:master Sep 14, 2023
44 checks passed
@derobins derobins deleted the cdeflate_warnings branch March 3, 2024 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - C Library Core C library issues Priority - 3. Low 🔽 Code cleanup, small feature change requests, etc. Type - Improvement Improvements that don't add a new feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants