3 Commits

Author SHA1 Message Date
nihui 0cdc3351c8 harden net loading (#6989)
* Harden Net graph loading and metadata validation

Apply count and blob index validation from Tencent/ncnn PRs #6902,
#6916, #6922 and #6949 to both text and binary graph loading. Bound
header counts to 1,000,000 while preserving repeated blob references
and zero-output layers.

Validate text integer tokens and name lengths, shape hint types,
record lengths and extent arithmetic, feature masks, layer type tags,
and one-blob layer connection counts. Guard missing producers during
extraction and handle null custom layer creators.

Own partially loaded layers before reading their connections, honor
registered destroyers on all failure and CPU replacement paths, and
clear stale graph metadata when reloading or rejecting a model.

Add in-memory Net regressions for malformed and truncated inputs, valid
shape layouts, reload isolation, custom layer lifetime and external
inputs, without requiring filesystem access.
Validated with native tests, SqueezeNet inference, ASan/UBSan and
32-bit big-endian PowerPC tests; compile checked Vulkan and reduced
C++03 configurations.

Sources:
https://github.com/Tencent/ncnn/pull/6902
https://github.com/Tencent/ncnn/pull/6916
https://github.com/Tencent/ncnn/pull/6922
https://github.com/Tencent/ncnn/pull/6949

Co-authored-by: kaltsit-10 <kaltsit-10@users.noreply.github.com>
Co-authored-by: beilzx <2069360659@qq.com>
Co-authored-by: ktz03 <2484593937@qq.com>
2026-09-14 14:23:50 +08:00
nihui 63a7a8a590 optional layer support any packing (#6392)
* split gemm tests, enable gemm vulkan any packing
2025-11-07 14:23:53 +08:00
nihui 3ab4b58d1d optional layer support vulkan packing (#6389)
* pyncnn expose layer support vulkan packing
* doc layer support behavior
2025-11-05 16:27:23 +08:00