The NTFS prober reads data based off an offset of the sector size.
If the sector size is unaligned and the read data is cached then other
probers can read unaligned values.
Sector sizes for NTFS actually only make sense as power-of-two so
validate that and as a sideeffect avoid the unaligned reads.
Also add the reproducer from OSS-Fuzz that found this issue.
Fixes #2509
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
*/
sector_size = le16_to_cpu(ns->bpb.sector_size);
- if (sector_size < 256 || sector_size > 4096)
+ if (sector_size < 256 || sector_size > 4096 || !is_power_of_2(sector_size))
return 1;
switch (ns->bpb.sectors_per_cluster) {