Commit ee92090
committed
fix(cam_hal): guard cam_verify_jpeg_eoi() against buffer-underflow
If DMA returns a frame shorter than two bytes, the previous code
did:
dptr = inbuf + length - 2;
which under-flows the pointer and produces undefined behaviour.
Behaviour for valid frames (length ≥ 2) is unchanged; damaged or
empty buffers are now discarded safely.1 parent cbed97c commit ee92090
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | | - | |
| 75 | + | |
71 | 76 | | |
72 | | - | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
0 commit comments