Commit 009008e
libvncclient: add bounds checks to UltraZip subrectangle parsing
HandleUltraZipBPP() iterates over sub-rectangles using numCacheRects
(derived from the attacker-controlled rect.r.x) without validating
that the pointer stays within the decompressed data buffer. A malicious
server can set a large numCacheRects value, causing heap out-of-bounds
reads via the memcpy calls in the parsing loop.
Add bounds checks before reading the 12-byte subrect header and before
advancing the pointer by the raw pixel data size. Use uint64_t for the
raw data size calculation to prevent integer overflow on 32-bit platforms.1 parent dc78dee commit 009008e
1 file changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
| 198 | + | |
197 | 199 | | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
201 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
| |||
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
216 | 229 | | |
217 | | - | |
| 230 | + | |
218 | 231 | | |
219 | 232 | | |
220 | 233 | | |
221 | 234 | | |
222 | 235 | | |
223 | 236 | | |
224 | 237 | | |
| 238 | + | |
0 commit comments