diff options
author | Michael Niedermayer | 2014-03-01 14:39:39 +0100 |
---|---|---|
committer | Michael Niedermayer | 2014-03-01 14:44:58 +0100 |
commit | 06fe29c41d3a93bd937295523477e4bd6eed934c (patch) | |
tree | e8e5f5201179a7562ac509c7211696e2b920c071 /tools | |
parent | 7fa3ec88da8831b5d61fe7cca0f45d2d48e2e387 (diff) | |
parent | ea7f79f93796d68559a495be824b6bbd94dfe5f6 (diff) |
Merge commit 'ea7f79f93796d68559a495be824b6bbd94dfe5f6'
* commit 'ea7f79f93796d68559a495be824b6bbd94dfe5f6':
qt-faststart: Avoid unintentionally sign extending BE_32
See: 582f36ca3fb1c69dbe3478f174d36278f5dd3f63
See: 69ce34c796dd2d595f3312848cf6d0c87506e0d0
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qt-faststart.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c index 5e1288b5f8..9cbabd9a8d 100644 --- a/tools/qt-faststart.c +++ b/tools/qt-faststart.c @@ -41,10 +41,10 @@ #define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1]) -#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \ - (((uint8_t*)(x))[1] << 16) | \ - (((uint8_t*)(x))[2] << 8) | \ - ((uint8_t*)(x))[3]) +#define BE_32(x) (((uint32_t)(((uint8_t*)(x))[0]) << 24) | \ + (((uint8_t*)(x))[1] << 16) | \ + (((uint8_t*)(x))[2] << 8) | \ + ((uint8_t*)(x))[3]) #define BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \ ((uint64_t)(((uint8_t*)(x))[1]) << 48) | \ @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) { break; } - atom_size = (uint32_t) BE_32(&atom_bytes[0]); + atom_size = BE_32(&atom_bytes[0]); atom_type = BE_32(&atom_bytes[4]); /* keep ftyp atom */ @@ -234,7 +234,7 @@ int main(int argc, char *argv[]) atom_type = BE_32(&moov_atom[i]); if (atom_type == STCO_ATOM) { printf(" patching stco atom...\n"); - atom_size = (uint32_t)BE_32(&moov_atom[i - 4]); + atom_size = BE_32(&moov_atom[i - 4]); if (i + atom_size - 4 > moov_atom_size) { printf(" bad atom size\n"); goto error_out; @@ -245,7 +245,7 @@ int main(int argc, char *argv[]) goto error_out; } for (j = 0; j < offset_count; j++) { - current_offset = (uint32_t)BE_32(&moov_atom[i + 12 + j * 4]); + current_offset = BE_32(&moov_atom[i + 12 + j * 4]); current_offset += moov_atom_size; moov_atom[i + 12 + j * 4 + 0] = (current_offset >> 24) & 0xFF; moov_atom[i + 12 + j * 4 + 1] = (current_offset >> 16) & 0xFF; @@ -255,7 +255,7 @@ int main(int argc, char *argv[]) i += atom_size - 4; } else if (atom_type == CO64_ATOM) { printf(" patching co64 atom...\n"); - atom_size = (uint32_t)BE_32(&moov_atom[i - 4]); + atom_size = BE_32(&moov_atom[i - 4]); if (i + atom_size - 4 > moov_atom_size) { printf(" bad atom size\n"); goto error_out; |