[vlc-commits] substx3g: Fix potential null dereference
Hugo Beauzée-Luyssen
git at videolan.org
Fri Jan 19 13:37:18 CET 2018
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Jan 19 11:54:42 2018 +0100| [9aaff39b57a72e70f2fd84922b3c1da70d3ca8ce] | committer: Hugo Beauzée-Luyssen
substx3g: Fix potential null dereference
CID #1464193
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9aaff39b57a72e70f2fd84922b3c1da70d3ca8ce
---
modules/codec/substx3g.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/modules/codec/substx3g.c b/modules/codec/substx3g.c
index 8904d200a6..0fba8b0948 100644
--- a/modules/codec/substx3g.c
+++ b/modules/codec/substx3g.c
@@ -695,24 +695,24 @@ static block_t * Encode( encoder_t *p_enc, subpicture_t *p_spu )
}
block_t *p_block = block_Alloc( i_len + 2 );
- if( p_block )
- {
- SetWBE(p_block->p_buffer, i_len);
- p_block->i_buffer = 2;
- for(const text_segment_t *p_segment = p_segments;
- p_segment; p_segment = p_segment->p_next )
- {
- size_t i_seglen = strlen(p_segment->psz_text);
- memcpy(&p_block->p_buffer[p_block->i_buffer],
- p_segment->psz_text, i_seglen);
- p_block->i_buffer += i_seglen;
- }
- p_block->i_dts = p_block->i_pts = p_spu->i_start;
- p_block->i_length = p_spu->i_stop - p_spu->i_start;
+ if( !p_block )
+ return NULL;
- if( i_styles > 0 )
- p_block->p_next = GetStylBlock( p_segments, i_styles );
+ SetWBE(p_block->p_buffer, i_len);
+ p_block->i_buffer = 2;
+ for(const text_segment_t *p_segment = p_segments;
+ p_segment; p_segment = p_segment->p_next )
+ {
+ size_t i_seglen = strlen(p_segment->psz_text);
+ memcpy(&p_block->p_buffer[p_block->i_buffer],
+ p_segment->psz_text, i_seglen);
+ p_block->i_buffer += i_seglen;
}
+ p_block->i_dts = p_block->i_pts = p_spu->i_start;
+ p_block->i_length = p_spu->i_stop - p_spu->i_start;
+
+ if( i_styles > 0 )
+ p_block->p_next = GetStylBlock( p_segments, i_styles );
return block_ChainGather( p_block );
}
More information about the vlc-commits
mailing list