Repository navigation
Commit 8ee41d7
committed
audio: copier: bound ALH mapping count to the gateway config size
copier_alh_assign_dai_index() reads alh_cfg.count from the host-supplied
gateway config blob and walks alh_cfg.mapping[0..count). count is only
clamped to the mapping[] array size (IPC4_ALH_MAX_NUMBER_OF_GTW), never to
the actual blob size, so a blob that advertises more mappings than it holds
makes the walk read past the config_data allocation. The same unchecked
count also underflows dma_config_length in the HDA branch
(config_length * 4 - get_alh_config_size()).
A fuzzer-crafted IPC4 copier init (config_length=13 -> 52-byte blob,
count=15 -> 128 bytes needed) triggers a heap out-of-bounds read reported
by AddressSanitizer at the SOF_DAI_INTEL_ALH mapping[] load.
Validate up front that the blob holds the fixed header (so count can be
read safely), that count is within the array bound, and that
get_alh_config_size() fits in the blob before touching mapping[]. Valid
ALH/HDA blobs are unaffected. This completes the earlier count guards by
bounding count against the actual blob size.
Also reject a gateway blob shorter than the fixed ALH header before
reading or logging alh_cfg.count. Although the original compound check
short-circuited the count validation safely, its error message still
dereferenced count for a truncated blob. Capture and report count only
after the header-size check succeeds.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>1 parent ec86f80 commit 8ee41d7
1 file changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
| |||
0 commit comments