]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zdb: fencepost error at zdb_cb.zcb_embedded_histogram[][]
authorGvozden Neskovic <neskovic@gmail.com>
Thu, 4 Aug 2016 14:23:35 +0000 (16:23 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 16 Aug 2016 21:53:09 +0000 (14:53 -0700)
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 <neskovic@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4934
Issue #4883

cmd/zdb/zdb.c

index 5a196c4522ccb9c111ea23bd5b916cbf52595f9a..6a076e65da5a300af1944c4ea715fe873e8fe141 100644 (file)
@@ -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;