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 calloc error on @base64d format (ref #3280) #3286

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

itchyny
Copy link
Contributor

@itchyny itchyny commented Mar 5, 2025

This commit fixes a regression of a8ce2ff, e.g. "=" | @base64d.

This commit fixes a regression of a8ce2ff, e.g. `"=" | @base64d`.
return jv_string("");
}
size_t decoded_len = (3 * (size_t)len) / 4; // 3 usable bytes for every 4 bytes of input
size_t decoded_len = MAX((3 * (size_t)len) / 4, 1); // 3 usable bytes for every 4 bytes of input
Copy link
Member

Choose a reason for hiding this comment

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

Ah doh sorry, yeah my suggetion wont work 👍 think i've convinced myself that below code in the case of len < 4 will not be able to write outside result

@itchyny itchyny merged commit 94fd973 into jqlang:master Mar 5, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants