[libbluray-devel] Avoid overread when graphics stream segment is empty/invalid

hpi1 git at videolan.org
Sun Aug 17 19:00:29 CEST 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Aug 15 12:56:33 2014 +0300| [f539ed0eb8983159df5d55ac2e82eeb9fa1c6054] | committer: hpi1

Avoid overread when graphics stream segment is empty/invalid

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=f539ed0eb8983159df5d55ac2e82eeb9fa1c6054
---

 src/libbluray/decoders/graphics_processor.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/decoders/graphics_processor.c b/src/libbluray/decoders/graphics_processor.c
index ea1ca3a..293767b 100644
--- a/src/libbluray/decoders/graphics_processor.c
+++ b/src/libbluray/decoders/graphics_processor.c
@@ -129,7 +129,7 @@ static void _join_fragments(PES_BUFFER *p1, PES_BUFFER *p2, int data_pos)
 /* return 1 if segment is ready for decoding, 0 if more data is needed */
 static int _join_segment_fragments(struct pes_buffer_s *p)
 {
-    uint8_t type = p->buf[0];
+    uint8_t type;
     unsigned id_pos = 0, id_len = 3, sd_pos = 6, data_pos = 0;
 
     if (p->len < 3) {
@@ -138,6 +138,7 @@ static int _join_segment_fragments(struct pes_buffer_s *p)
 
     /* check segment type */
 
+    type = p->buf[0];
     if (type == PGS_OBJECT) {
         id_pos = 3;
         sd_pos = 6;



More information about the libbluray-devel mailing list