Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1055)

Side by Side Diff: third_party/libopenjpeg20/j2k.c

Issue 2353463002: Fix memory leak in opj_j2k_merge_ppt.
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libopenjpeg20/README.pdfium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * The copyright in this software is being made available under the 2-clauses 2 * The copyright in this software is being made available under the 2-clauses
3 * BSD License, included below. This software may be subject to other third 3 * BSD License, included below. This software may be subject to other third
4 * party and contributor rights, including patent rights, and no such rights 4 * party and contributor rights, including patent rights, and no such rights
5 * are granted under this license. 5 * are granted under this license.
6 * 6 *
7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 7 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
8 * Copyright (c) 2002-2014, Professor Benoit Macq 8 * Copyright (c) 2002-2014, Professor Benoit Macq
9 * Copyright (c) 2001-2003, David Janssens 9 * Copyright (c) 2001-2003, David Janssens
10 * Copyright (c) 2002-2003, Yannick Verschueren 10 * Copyright (c) 2002-2003, Yannick Verschueren
(...skipping 3789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 * 3800 *
3801 * @param p_tcp the tile. 3801 * @param p_tcp the tile.
3802 * @param p_manager the user event manager. 3802 * @param p_manager the user event manager.
3803 */ 3803 */
3804 static OPJ_BOOL opj_j2k_merge_ppt(opj_tcp_t *p_tcp, opj_event_mgr_t * p_manager) 3804 static OPJ_BOOL opj_j2k_merge_ppt(opj_tcp_t *p_tcp, opj_event_mgr_t * p_manager)
3805 { 3805 {
3806 OPJ_UINT32 i, l_ppt_data_size; 3806 OPJ_UINT32 i, l_ppt_data_size;
3807 /* preconditions */ 3807 /* preconditions */
3808 assert(p_tcp != 00); 3808 assert(p_tcp != 00);
3809 assert(p_manager != 00); 3809 assert(p_manager != 00);
3810 » assert(p_tcp->ppt_buffer == NULL); 3810 »
3811 » if(p_tcp->ppt_buffer != NULL) {
dsinclair 2016/09/19 12:59:01 Have we verified this can ever happen? It's a prec
3812 » » return OPJ_FALSE;
3813 » }
3811 3814
3812 if (p_tcp->ppt == 0U) { 3815 if (p_tcp->ppt == 0U) {
3813 return OPJ_TRUE; 3816 return OPJ_TRUE;
3814 } 3817 }
3815 3818
3816 l_ppt_data_size = 0U; 3819 l_ppt_data_size = 0U;
3817 for (i = 0U; i < p_tcp->ppt_markers_count; ++i) { 3820 for (i = 0U; i < p_tcp->ppt_markers_count; ++i) {
3818 l_ppt_data_size += p_tcp->ppt_markers[i].m_data_size; /* can't o verflow, max 256 markers of max 65536 bytes */ 3821 l_ppt_data_size += p_tcp->ppt_markers[i].m_data_size; /* can't o verflow, max 256 markers of max 65536 bytes */
3819 } 3822 }
3820 3823
(...skipping 6997 matching lines...) Expand 10 before | Expand all | Expand 10 after
10818 return OPJ_FALSE; 10821 return OPJ_FALSE;
10819 } 10822 }
10820 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) { 10823 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) {
10821 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index); 10824 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index);
10822 return OPJ_FALSE; 10825 return OPJ_FALSE;
10823 } 10826 }
10824 } 10827 }
10825 10828
10826 return OPJ_TRUE; 10829 return OPJ_TRUE;
10827 } 10830 }
OLDNEW
« no previous file with comments | « third_party/libopenjpeg20/README.pdfium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698