fix(HIGH-04): add OOM guard for mask calloc in stories_mil.h

- stories_mil.h: get_mask_blob() mask calloc now guarded with abort()
  on NULL before immediate array write

ref: docs/reports/security-audit-2026-03-02.md HIGH-04
This commit is contained in:
manni07 2026-03-02 23:33:37 +01:00
parent 87014bd847
commit 42eae54975
1 changed files with 1 additions and 0 deletions

View File

@ -277,6 +277,7 @@ static NSData *g_mask_blob = nil;
static NSData *get_mask_blob(void) {
if (!g_mask_blob) {
_Float16 *mask = (_Float16*)calloc(SEQ*SEQ, sizeof(_Float16));
if (!mask) { fprintf(stderr, "OOM: calloc(mask %dx%d)\n", SEQ, SEQ); abort(); } // HIGH-04
for(int t=0;t<SEQ;t++) for(int t2=0;t2<SEQ;t2++)
mask[t*SEQ+t2] = (t2<=t) ? (_Float16)0.0f : (_Float16)(-65504.0f);
g_mask_blob = build_blob_fp16(mask, SEQ*SEQ);