Commit 7342818
committed
audio: tdfb: Improve robustness for invalid configuration
Add several validity checks against malformed configuration blobs and
malformed IPC control payloads:
- Verify that the self-declared config->size matches the size reported
by the data-blob handler. The blob size is now stored in
cd->config_size (set in both tdfb_prepare and the runtime blob-update
path) so tdfb_init_coef can confirm the two agree before any further
offset arithmetic that depends on config->size.
- Reject angle_enum_mult == 0, which would otherwise collapse the
azimuth target computation to a constant.
- Reject filter_angles[].filter_index values that are negative or that
would make the per-bank seek run past the total filter-block count.
- Reject negative input_channel_select[] entries; the field is int16_t
and an untrusted blob can supply a value that bypasses the existing
'> max_ch' check but is still used as an array index.
- Increase the local time-difference array in
theoretical_time_differences() from PLATFORM_MAX_CHANNELS (4 or 8 per
platform) to SOF_TDFB_MAX_MICROPHONES (16), matching the validated
upper bound on num_mic_locations.
- Clamp cdata->num_elems to SOF_IPC_MAX_CHANNELS in the IPC3 GET
handler so the chanv[] write loop cannot run past the payload,
matching the volume_ipc3 convention.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>1 parent 3f7738d commit 7342818
4 files changed
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
326 | 331 | | |
327 | 332 | | |
328 | 333 | | |
| |||
348 | 353 | | |
349 | 354 | | |
350 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
351 | 361 | | |
352 | 362 | | |
353 | 363 | | |
| |||
423 | 433 | | |
424 | 434 | | |
425 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
426 | 442 | | |
427 | 443 | | |
428 | 444 | | |
| |||
451 | 467 | | |
452 | 468 | | |
453 | 469 | | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
454 | 475 | | |
455 | 476 | | |
456 | 477 | | |
| |||
641 | 662 | | |
642 | 663 | | |
643 | 664 | | |
644 | | - | |
| 665 | + | |
645 | 666 | | |
646 | 667 | | |
647 | 668 | | |
| |||
705 | 726 | | |
706 | 727 | | |
707 | 728 | | |
708 | | - | |
709 | 729 | | |
710 | 730 | | |
711 | 731 | | |
| |||
735 | 755 | | |
736 | 756 | | |
737 | 757 | | |
738 | | - | |
739 | | - | |
| 758 | + | |
| 759 | + | |
740 | 760 | | |
741 | 761 | | |
742 | 762 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
115 | 118 | | |
116 | 119 | | |
117 | 120 | | |
| |||
0 commit comments