| @@ -19,6 +19,8 @@ · 18 unmodified lines |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | | 21 | |
| | 22 | #include <inttypes.h> |
| | 23 | |
| 22 | #include "avformat.h" | 24 | #include "avformat.h" |
| 23 | #include "riff.h" | 25 | #include "riff.h" |
| 24 | | 26 | |
| @@ -90,7 +92,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) · 65 unmodified lines |
| 90 | * codecs require extradata, so we provide our own fake extradata. | 92 | * codecs require extradata, so we provide our own fake extradata. |
| 91 | * | 93 | * |
| 92 | * First, check that there really was no extradata in the header. If | 94 | * First, check that there really was no extradata in the header. If |
| 93 | * there was, then try to use, after asking the the user to provide a | 95 | * there was, then try to use it, after asking the user to provide a |
| 94 | * sample of this unusual file. | 96 | * sample of this unusual file. |
| 95 | */ | 97 | */ |
| 96 | if (st->codec->extradata_size != 0) { | 98 | if (st->codec->extradata_size != 0) { |
| @@ -129,7 +131,7 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) · 32 unmodified lines |
| 129 | /* Quoting the MSDN xWMA docs on the dpds chunk: "Contains the | 131 | /* Quoting the MSDN xWMA docs on the dpds chunk: "Contains the |
| 130 | * decoded packet cumulative data size array, each element is the | 132 | * decoded packet cumulative data size array, each element is the |
| 131 | * number of bytes accumulated after the corresponding xWMA packet | 133 | * number of bytes accumulated after the corresponding xWMA packet |
| 132 | * is decoded in order" | 134 | * is decoded in order." |
| 133 | * | 135 | * |
| 134 | * Each packet has size equal to st->codec->block_align, which in | 136 | * Each packet has size equal to st->codec->block_align, which in |
| 135 | * all cases I saw so far was always 2230. Thus, we can use the | 137 | * all cases I saw so far was always 2230. Thus, we can use the |
| @@ -144,11 +146,13 @@ static int xwma_read_header(AVFormatContext *s, AVFormatParameters *ap) · 8 unmodified lines |
| 144 | | 146 | |
| 145 | /* Compute the number of entries in the dpds chunk. */ | 147 | /* Compute the number of entries in the dpds chunk. */ |
| 146 | if (size & 3) { /* Size should be divisible by four */ | 148 | if (size & 3) { /* Size should be divisible by four */ |
| 147 | av_log(s, AV_LOG_WARNING, "dpds chunk size "PRId64" not divisible by 4\n", size); | 149 | av_log(s, AV_LOG_WARNING, |
| | 150 | "dpds chunk size %"PRId64" not divisible by 4\n", size); |
| 148 | } | 151 | } |
| 149 | dpds_table_size = size / 4; | 152 | dpds_table_size = size / 4; |
| 150 | if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) { | 153 | if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) { |
| 151 | av_log(s, AV_LOG_ERROR, "dpds chunk size "PRId64" invalid\n", size); | 154 | av_log(s, AV_LOG_ERROR, |
| | 155 | "dpds chunk size %"PRId64" invalid\n", size); |
| 152 | return -1; | 156 | return -1; |
| 153 | } | 157 | } |
| 154 | | 158 | |