[FFmpeg-devel] libavformat/dashdec: Fix for Bug #7338

Submitted by Colin NG on Aug. 7, 2018, 8:12 p.m.

Details

Message ID BN6PR22MB0337B014B6CD56734B69A8BAFE270@BN6PR22MB0337.namprd22.prod.outlook.com
State New
Headers show

Commit Message

Colin NG Aug. 7, 2018, 8:12 p.m.
---
 libavformat/dashdec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Carl Eugen Hoyos Aug. 7, 2018, 8:22 p.m.
2018-08-07 22:12 GMT+02:00, Colin NG <colin_ng@hotmail.com>:
> ---
>  libavformat/dashdec.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> index 09b06ef..fa784f1 100644
> --- a/libavformat/dashdec.c
> +++ b/libavformat/dashdec.c
> @@ -1040,7 +1040,6 @@ end:
>          xmlFree(rep_bandwidth_val);
>      if (rep_framerate_val)
>          xmlFree(rep_framerate_val);
> -
>      return ret;
>  }

No unrelated changes please.

> @@ -1869,7 +1868,7 @@ static int is_common_init_section_exist(struct
> representation **pls, int n_pls)
>      url = first_init_section->url;
>      url_offset = first_init_section->url_offset;
>      size = pls[0]->init_section->size;
> -    for (i=0;i<n_pls;i++) {
> +    for (i=1; i<n_pls; i++) {

If you change the whitespace here (many will find this is a good idea),
please also add spaces around the operators: (i = 1; i < n_pls; i++)

Carl Eugen
Carl Eugen Hoyos Aug. 7, 2018, 8:24 p.m.
2018-08-07 22:12 GMT+02:00, Colin NG <colin_ng@hotmail.com>:
> ---
>  libavformat/dashdec.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

And I forgot: Please fix the commit message.
Something like "lavf/dashdec: Fix double free in case of ..."
And "Fixes ticket #7338" (bugs are elsewhere).

Thank you, Carl Eugen

Patch hide | download patch | download mbox

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 09b06ef..fa784f1 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1040,7 +1040,6 @@  end:
         xmlFree(rep_bandwidth_val);
     if (rep_framerate_val)
         xmlFree(rep_framerate_val);
-
     return ret;
 }
 
@@ -1869,7 +1868,7 @@  static int is_common_init_section_exist(struct representation **pls, int n_pls)
     url = first_init_section->url;
     url_offset = first_init_section->url_offset;
     size = pls[0]->init_section->size;
-    for (i=0;i<n_pls;i++) {
+    for (i=1; i<n_pls; i++) {
         if (av_strcasecmp(pls[i]->init_section->url,url) || pls[i]->init_section->url_offset != url_offset || pls[i]->init_section->size != size) {
             return 0;
         }
@@ -1879,7 +1878,6 @@  static int is_common_init_section_exist(struct representation **pls, int n_pls)
 
 static void copy_init_section(struct representation *rep_dest, struct representation *rep_src)
 {
-    *rep_dest->init_section = *rep_src->init_section;
     rep_dest->init_sec_buf = av_mallocz(rep_src->init_sec_buf_size);
     memcpy(rep_dest->init_sec_buf, rep_src->init_sec_buf, rep_src->init_sec_data_len);
     rep_dest->init_sec_buf_size = rep_src->init_sec_buf_size;