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 <neskovic@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4934
Issue #4883
This commit is contained in:
Gvozden Neskovic 2016-08-04 16:23:35 +02:00 committed by Brian Behlendorf
parent fc897b24b2
commit f0c26069bd

View 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;