Browse files

Fix NULL pointer access when starting decoding anywhere in the stream.

The referenced last_vcl_nal exists only when decoding starts at an IDR frame.
Starting anywhere else may lead to a NULL pointer access.
  • Loading branch information...
1 parent 70e76fb commit 8de21191c939016e127d075f8c125028fdb60a97 huceke committed Jul 31, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 h264_parser.c
View
2 h264_parser.c
@@ -378,7 +378,7 @@ void calculate_pic_order(struct h264_parser *parser, struct coded_picture *pic,
pic->top_field_order_cnt = parser->prev_top_field_order_cnt;
} else if (sps->pic_order_cnt_type == 2) {
- uint32_t prev_frame_num = parser->last_vcl_nal->slc.frame_num;
+ uint32_t prev_frame_num = parser->last_vcl_nal ? parser->last_vcl_nal->slc.frame_num : 0;
uint32_t prev_frame_num_offset = parser->frame_num_offset;
uint32_t temp_pic_order_cnt = 0;

0 comments on commit 8de2119

Please sign in to comment.