"Fossies" - the Fresh Open Source Software Archive

Member "texmaker-5.0.4/pdfium/third_party/libopenjpeg20/0002-packet-iterator.patch" (16 Apr 2017, 849 Bytes) of package /linux/misc/texmaker-5.0.4.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Diff source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 diff --git a/third_party/libopenjpeg20/pi.c b/third_party/libopenjpeg20/pi.c
    2 index 1697bcb..06f1e41 100644
    3 --- a/third_party/libopenjpeg20/pi.c
    4 +++ b/third_party/libopenjpeg20/pi.c
    5 @@ -36,6 +36,7 @@
    6   * POSSIBILITY OF SUCH DAMAGE.
    7   */
    8  
    9 +#include <limits.h>
   10  #include "opj_includes.h"
   11  
   12  /** @defgroup PI PI - Implementation of a packet iterator */
   13 @@ -1236,7 +1237,13 @@ opj_pi_iterator_t *opj_pi_create_decode(opj_image_t *p_image,
   14     l_current_pi = l_pi;
   15  
   16     /* memory allocation for include */
   17 -   l_current_pi->include = (OPJ_INT16*) opj_calloc((l_tcp->numlayers +1) * l_step_l, sizeof(OPJ_INT16));
   18 +   l_current_pi->include = 00;
   19 +   if
   20 +       (l_step_l && l_tcp->numlayers < UINT_MAX / l_step_l - 1)
   21 +   {
   22 +       l_current_pi->include = (OPJ_INT16*)opj_calloc((l_tcp->numlayers + 1) * l_step_l, sizeof(OPJ_INT16));
   23 +   }
   24 +
   25     if
   26         (!l_current_pi->include)
   27     {