diff options
author | hucongcong <hucong.c@foxmail.com> | 2016-11-22 13:40:08 +0800 |
---|---|---|
committer | hucongcong <hucong.c@foxmail.com> | 2016-11-22 13:40:08 +0800 |
commit | 8b8b6f41e62407979cbd3d2a91afcdfdd1a0afd8 (patch) | |
tree | 52be342547900cf9f181a272416d4622e34529cb /src/http/modules/ngx_http_mp4_module.c | |
parent | 551091951a479e2f512062c51bdcc6157a211164 (diff) | |
download | nginx-8b8b6f41e62407979cbd3d2a91afcdfdd1a0afd8.tar.gz nginx-8b8b6f41e62407979cbd3d2a91afcdfdd1a0afd8.zip |
Mp4: fixed setting wrong mdat atom size in very rare cases.
Atom size is the sum of atom header size and atom data size. The
specification says that the first 4 bytes are set to one when
the atom size is greater than the maximum unsigned 32-bit value.
Which means atom header size should be considered when the
comparison takes place between atom data size and 0xffffffff.
Diffstat (limited to 'src/http/modules/ngx_http_mp4_module.c')
-rw-r--r-- | src/http/modules/ngx_http_mp4_module.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c index 8f2920f64..f3c0fddb9 100644 --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -1229,7 +1229,9 @@ ngx_http_mp4_update_mdat_atom(ngx_http_mp4_file_t *mp4, off_t start_offset, atom_header = mp4->mdat_atom_header; - if ((uint64_t) atom_data_size > (uint64_t) 0xffffffff) { + if ((uint64_t) atom_data_size + > (uint64_t) 0xffffffff - sizeof(ngx_mp4_atom_header_t)) + { atom_size = 1; atom_header_size = sizeof(ngx_mp4_atom_header64_t); ngx_mp4_set_64value(atom_header + sizeof(ngx_mp4_atom_header_t), |