Skip to content

Commit

Permalink
Safe limit increase (#221)
Browse files Browse the repository at this point in the history
* Remove file size limit

* Restore limit with an overflow check

Suggested in kcat/openal-soft#1026 (comment)

* Fixed SOFA limit

* Restore original intendation

* Restore coding style spacing

* Fix "undeclared identifier" error

Error:
"libmysofa/src/hdf/btree.c:269:48: note: each undeclared identifier is reported only once for each function it appears in
269 |   if (elements <= 0 || size <= 0 || elements > INT_MAX/size)
This is probably fixable by adding #include <limits.h>"

* Create build.yml

* Remove workflow belonging to a different branch
  • Loading branch information
ThreeDeeJay authored Sep 17, 2024
1 parent 1f9c8df commit f4dab48
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/hdf/btree.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

/*
*
Expand Down Expand Up @@ -266,7 +267,7 @@ int treeRead(struct READER *reader, struct DATAOBJECT *data) {

mylog("elements %d size %d\n", elements, size);

if (elements <= 0 || size <= 0 || elements >= 0x130000 || size > 0x10)
if (elements <= 0 || size <= 0 || elements > INT_MAX/size)
return MYSOFA_INVALID_FORMAT; // LCOV_EXCL_LINE
if (!(output = malloc(elements * size))) {
return MYSOFA_NO_MEMORY; // LCOV_EXCL_LINE
Expand Down

0 comments on commit f4dab48

Please sign in to comment.