aarch64:在 padding 之后,内核分发使用了过期的 elempack → `conv3x3s2_pack4_neon`,发生越界读(非确定性 NaN/SIGSEGV),导致输入为合法的 dims=2 Mat
作者: potato34创建于 2026年9月22日更新于 2026年9月23日
- dims=2 input:
ncnn::Mat in(w, h, sizeof(float))→ 640×16, elemsize=4, elempack=1, dims=2. 2. Automatic packing into pack4 (in "resolve dst_elempack" in src/net.cpp): when dims==2,elemcount = elempack * h = 16;16 % 4 == 0→dst_elempack = 4→convert_packing→ pack4 blob: w=640, h=4, elemsize=16. 3. Weight construction with pack1 input:Convolution::create_pipelinededucesnum_input = weight_data_size / maxk / num_output = 1→ weight elempack = 1. 4. Padding to unpack pack4 into pack1: convolution for the first layer is 3×3, dilation 1×1, stride (2,2), pad 1/1/1/1.make_padding→copy_make_border(1,1,1,1); ARM padding implementation for dims=2 + elempack=4:outh = h*elempack + top + bottom = 4*4+1+1 = 18→out_elempack = 18%4==0 ? 4 : 1 = 1→ the general path is used to unpack into pack1 → the blob after padding is 642×18, elemsize=4, elempack=1. 5. Distribution using the elempack snapshot before padding:Convolution_arm::forwardcapturesint elempack = bottom_blob.elempack;(in convolution_arm.cpp, around line 403) beforemake_padding(around line 411); after padding, onlyw/his updated (around lines 415–416),elempackis not updated.
内容来源: Tencent/ncnn