History

segafilm: Check for memory allocation failures in segafilm demuxer.

Laurent Aimar committed 15 years ago

Commit 7cbe0251 parent 3eb1e651 file · +6 −0Browse files

Unified · Split

libavformat/segafilm.c+6−0
@@ -176,6 +176,8 @@ static int film_read_header(AVFormatContext *s, · 175 unmodified lines
176176 if(film->sample_count >= UINT_MAX / sizeof(film_sample))
177177 return -1;
178178 film->sample_table = av_malloc(film->sample_count * sizeof(film_sample));
179+ if (!film->sample_table)
180+ return AVERROR(ENOMEM);
179181
180182 for(i=0; i<s->nb_streams; i++)
181183 av_set_pts_info(s->streams[i], 33, 1, film->base_clock);
@@ -252,6 +254,10 @@ static int film_read_packet(AVFormatContext *s, · 70 unmodified lines
252254 av_free(film->stereo_buffer);
253255 film->stereo_buffer_size = sample->sample_size;
254256 film->stereo_buffer = av_malloc(film->stereo_buffer_size);
257+ if (!film->stereo_buffer) {
258+ film->stereo_buffer_size = 0;
259+ return AVERROR(ENOMEM);
260+ }
255261 }
256262
257263 pkt->pos= avio_tell(pb);

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