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
176 if(film->sample_count >= UINT_MAX / sizeof(film_sample))176 if(film->sample_count >= UINT_MAX / sizeof(film_sample))
177 return -1;177 return -1;
178 film->sample_table = av_malloc(film->sample_count * sizeof(film_sample));178 film->sample_table = av_malloc(film->sample_count * sizeof(film_sample));
179 if (!film->sample_table)
180 return AVERROR(ENOMEM);
179 181
180 for(i=0; i<s->nb_streams; i++)182 for(i=0; i<s->nb_streams; i++)
181 av_set_pts_info(s->streams[i], 33, 1, film->base_clock);183 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
252 av_free(film->stereo_buffer);254 av_free(film->stereo_buffer);
253 film->stereo_buffer_size = sample->sample_size;255 film->stereo_buffer_size = sample->sample_size;
254 film->stereo_buffer = av_malloc(film->stereo_buffer_size);256 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 }
255 }261 }
256 262
257 pkt->pos= avio_tell(pb);263 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