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

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

Issue 2001663002: openjpeg: Prevent a buffer overflow in opj_j2k_read_SPCod_SPCoc. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 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 8726 matching lines...) Expand 10 before | Expand all | Expand 10 after
8737 assert(p_j2k != 00); 8737 assert(p_j2k != 00);
8738 assert(p_manager != 00); 8738 assert(p_manager != 00);
8739 assert(p_header_data != 00); 8739 assert(p_header_data != 00);
8740 8740
8741 l_cp = &(p_j2k->m_cp); 8741 l_cp = &(p_j2k->m_cp);
8742 l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ? 8742 l_tcp = (p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_TPH) ?
8743 &l_cp->tcps[p_j2k->m_current_tile_number] : 8743 &l_cp->tcps[p_j2k->m_current_tile_number] :
8744 p_j2k->m_specific_param.m_decoder.m_default_tcp; 8744 p_j2k->m_specific_param.m_decoder.m_default_tcp;
8745 8745
8746 /* precondition again */ 8746 /* precondition again */
8747 assert(compno < p_j2k->m_private_image->numcomps); 8747 if (compno >= p_j2k->m_private_image->numcomps) {
8748 return OPJ_FALSE;
8749 }
8748 8750
8749 l_tccp = &l_tcp->tccps[compno]; 8751 l_tccp = &l_tcp->tccps[compno];
8750 l_current_ptr = p_header_data; 8752 l_current_ptr = p_header_data;
8751 8753
8752 /* make sure room is sufficient */ 8754 /* make sure room is sufficient */
8753 if (*p_header_size < 5) { 8755 if (*p_header_size < 5) {
8754 opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc e lement\n"); 8756 opj_event_msg(p_manager, EVT_ERROR, "Error reading SPCod SPCoc e lement\n");
8755 return OPJ_FALSE; 8757 return OPJ_FALSE;
8756 } 8758 }
8757 8759
(...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after
10810 return OPJ_FALSE; 10812 return OPJ_FALSE;
10811 } 10813 }
10812 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) { 10814 if (! opj_j2k_post_write_tile(p_j2k,p_stream,p_manager)) {
10813 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index); 10815 opj_event_msg(p_manager, EVT_ERROR, "Error while opj_j2k _post_write_tile with tile index = %d\n", p_tile_index);
10814 return OPJ_FALSE; 10816 return OPJ_FALSE;
10815 } 10817 }
10816 } 10818 }
10817 10819
10818 return OPJ_TRUE; 10820 return OPJ_TRUE;
10819 } 10821 }
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