Changeset 8632e67b53ba6aefa42d080668eaa13dcfe42cf1
- Timestamp:
- 03/02/08 09:48:28
(2 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1204447708 +0200
- git-parent:
[09572892df7e72c0d4e598c0b5e076cf330d8b0a]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1204403550 +0200
- Message:
Fix (trunk-only) integer underflow in MP4 0xa9xxx box
Pointed-out-by: Drew Yao
Signed-off-by: Rémi Denis-Courmont <rem@videolan.org>
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r0957289 |
r8632e67 |
|
| 2116 | 2116 | static int MP4_ReadBox_0xa9xxx( stream_t *p_stream, MP4_Box_t *p_box ) |
|---|
| 2117 | 2117 | { |
|---|
| 2118 | | uint16_t i_length, i_dummy; |
|---|
| | 2118 | uint16_t i16; |
|---|
| | 2119 | size_t i_length; |
|---|
| 2119 | 2120 | |
|---|
| 2120 | 2121 | MP4_READBOX_ENTER( MP4_Box_data_0xa9xxx_t ); |
|---|
| … | … | |
| 2122 | 2123 | p_box->data.p_0xa9xxx->psz_text = NULL; |
|---|
| 2123 | 2124 | |
|---|
| 2124 | | MP4_GET2BYTES( i_length ); |
|---|
| | 2125 | MP4_GET2BYTES( i16 ); |
|---|
| | 2126 | i_length = i16 + 1; |
|---|
| 2125 | 2127 | |
|---|
| 2126 | 2128 | if( i_length > 0 ) |
|---|
| 2127 | 2129 | { |
|---|
| 2128 | | MP4_GET2BYTES( i_dummy ); |
|---|
| 2129 | | if( i_length > i_read ) i_length = i_read; |
|---|
| 2130 | | |
|---|
| 2131 | | p_box->data.p_0xa9xxx->psz_text = malloc( i_length + 1 ); |
|---|
| 2132 | | |
|---|
| | 2130 | MP4_GET2BYTES( i16 ); |
|---|
| | 2131 | if( i_length >= i_read ) i_length = i_read + 1; |
|---|
| | 2132 | |
|---|
| | 2133 | p_box->data.p_0xa9xxx->psz_text = malloc( i_length ); |
|---|
| | 2134 | |
|---|
| | 2135 | i_length--; |
|---|
| 2133 | 2136 | memcpy( p_box->data.p_0xa9xxx->psz_text, |
|---|
| 2134 | 2137 | p_peek, i_length ); |
|---|
| … | … | |
| 2161 | 2164 | MP4_GET4BYTES( i_reserved ); |
|---|
| 2162 | 2165 | // version should be 0, flags should be 1 for text, 0 for data |
|---|
| 2163 | | if( i_version == 0x00000001 ) |
|---|
| | 2166 | if( ( i_version == 0x00000001 ) && (i_data_len >= 12 ) ) |
|---|
| 2164 | 2167 | { |
|---|
| 2165 | 2168 | // the rest is the text |
|---|