| Summary: | SEGV_UNKNOW in function SDL_free_REAL at SDL_malloc.c:5372-5 | ||
|---|---|---|---|
| Product: | SDL_image | Reporter: | pwd <teamseri0us360> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | hle |
| Version: | 2.0.4 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: |
poc
CVE-2019-12221: patch proposal (pcx: do not write directly to row buffer) |
||
|
Description
pwd
2019-05-09 06:49:35 UTC
Created attachment 3797 [details]
CVE-2019-12221: patch proposal (pcx: do not write directly to row buffer)
Patch proposal in attachment.
I can provide more detailed explanations if needed.
(In reply to Hugo Lefeuvre from comment #1) > Created attachment 3797 [details] > CVE-2019-12221: patch proposal (pcx: do not write directly to row buffer) > > Patch proposal in attachment. > > I can provide more detailed explanations if needed. (rationale is in the patch's header, putting it here as well for readability) The PCX format specifies pcxh.BytesPerLine, which represents the size of a single plane's scanline in bytes. Valid PCX images should have pcxh.BytesPerLine >= surface->pitch. pcxh.BytesPerLine and surface->pitch can legitimately be different because pcxh.BytesPerLine is padded to be a multiple of machine word length (where file was created). If src_bits == 8 we directly read a whole scanline from src to row. This is a problem in the case where bpl > surface->pitch because row is too small. This allows attacker to perform unlimited OOB write on the heap. + remove pointless check bpl > surface->pitch, this is a valid situation + make sure we always read into buf which is big enough + in the case where src_bits == 8: copy these bytes back to row afterwards Fixed, thanks! https://hg.libsdl.org/SDL_image/rev/e7e9786a1a34 |