From f4dab484e6d57d7bd8302c12e07490a1c75454bd Mon Sep 17 00:00:00 2001 From: 3DJ <71472458+ThreeDeeJay@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:12:49 -0400 Subject: [PATCH] Safe limit increase (#221) * Remove file size limit * Restore limit with an overflow check Suggested in https://github.com/kcat/openal-soft/pull/1026#issuecomment-2268680856 * 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 " * Create build.yml * Remove workflow belonging to a different branch --- src/hdf/btree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hdf/btree.c b/src/hdf/btree.c index e847b24..7bb2236 100644 --- a/src/hdf/btree.c +++ b/src/hdf/btree.c @@ -9,6 +9,7 @@ #include #include #include +#include /* * @@ -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