From: Gvozden Neskovic Date: Thu, 4 Aug 2016 14:23:35 +0000 (+0200) Subject: zdb: fencepost error at zdb_cb.zcb_embedded_histogram[][] X-Git-Tag: zfs-0.7.0-rc1~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0c26069bdf4ec675c840f0932fcfe7d4036d06f;p=zfs zdb: fencepost error at zdb_cb.zcb_embedded_histogram[][] Erroneous access detected by gcc UndefinedBehaviorSanitizer: `zdb.c:2424:7: runtime error: index 112 out of bounds for type 'uint64_t [112]'` Fix: increase histogram size by 1 to accommodate all possible sizes. Signed-off-by: Gvozden Neskovic Signed-off-by: Brian Behlendorf Closes #4934 Issue #4883 --- diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index 5a196c452..6a076e65d 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -2354,7 +2354,7 @@ typedef struct zdb_cb { uint64_t zcb_dedup_blocks; uint64_t zcb_embedded_blocks[NUM_BP_EMBEDDED_TYPES]; uint64_t zcb_embedded_histogram[NUM_BP_EMBEDDED_TYPES] - [BPE_PAYLOAD_SIZE]; + [BPE_PAYLOAD_SIZE + 1]; uint64_t zcb_start; uint64_t zcb_lastprint; uint64_t zcb_totalasize;