History

avcodec/sunrast: fix leak in sunrast_decode_frame()

In sunrast_decode_frame(), we use av_malloc_array() allocates memory to ptr and ptr2. However if buf_end - buf < 1, this function returns error code without freeing this memory thus cause a leak. Add av_freep() before return.

Lidong Yan committed 1 year ago

Commit 98afcd31 parent 7ed5a701 file · +3 −1Browse files

Unified · Split

libavcodec/sunrast.c+3−1
@@ -163,8 +163,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, AVFrame *p, · 162 unmodified lines
163163 x = 0;
164164 while (ptr != end && buf < buf_end) {
165165 run = 1;
166− if (buf_end - buf < 1)
166+ if (buf_end - buf < 1) {
167+ av_freep(&ptr2);
167168 return AVERROR_INVALIDDATA;
169+ }
168170
169171 if ((value = *buf++) == RLE_TRIGGER) {
170172 run = *buf++ + 1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t