-
-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
On code>=6, blosc2_compcode_to_compname returns a non-negative code but produces a null compname; according to the docs, -1 should be returned if the codec is not recognized. (not a serious issue but could be fixed easily)
I believe the issue is here:
Lines 293 to 294 in 4808890
| else if (compcode >= BLOSC_LAST_CODEC) | |
| code = compcode; |
testcase.cpp
#include <cstdio>
#include <cstdlib>
extern "C" {
#include "blosc2.h"
}
int main() {
// Pick a compcode that is not mapped/available in this build; 6 reproduces the issue here
int code = 6;
const char* compname = nullptr;
int rc = blosc2_compcode_to_compname(code, &compname);
// According to documentation, unknown/unsupported codes should return -1.
// Observed behavior: rc == code (>=0) and compname == NULL for code 6.
if (rc >= 0 && compname == nullptr) {
// Demonstrate the contract violation
fprintf(stderr, "contract violation: rc=%d, compname is NULL for code=%d\n", rc, code);
abort();
}
return 0;
}Metadata
Metadata
Assignees
Labels
No labels