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

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_Image.cpp

Issue 437483004: Fix unninitialized 'tmp' in CJBig2_Image::composeTo_opt2 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | 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 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "JBig2_Image.h" 7 #include "JBig2_Image.h"
8 #include "../../../include/fxcrt/fx_basic.h" 8 #include "../../../include/fxcrt/fx_basic.h"
9 #include "../../../include/fxcrt/fx_coordinates.h" 9 #include "../../../include/fxcrt/fx_coordinates.h"
10 #include <limits.h> 10 #include <limits.h>
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 return; 769 return;
770 } 770 }
771 m_pData = (FX_BYTE*)m_pModule->JBig2_Realloc(m_pData, h * m_nStride); 771 m_pData = (FX_BYTE*)m_pModule->JBig2_Realloc(m_pData, h * m_nStride);
772 if(h > m_nHeight) { 772 if(h > m_nHeight) {
773 JBIG2_memset(m_pData + m_nHeight * m_nStride, v ? 0xff : 0, (h - m_nHeig ht)*m_nStride); 773 JBIG2_memset(m_pData + m_nHeight * m_nStride, v ? 0xff : 0, (h - m_nHeig ht)*m_nStride);
774 } 774 }
775 m_nHeight = h; 775 m_nHeight = h;
776 } 776 }
777 FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op) 777 FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, FX_INT32 x, FX_INT32 y, JBig2ComposeOp op)
778 { 778 {
779 FX_INT32 xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; 779 FX_INT32 xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0,
780 FX_DWORD s1, d1, d2, shift, shift1, shift2, tmp, tmp1, tmp2, maskL, maskR, m askM; 780 yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0;
781 FX_BYTE *lineSrc, *lineDst, *sp, *dp; 781
782 FX_DWORD s1 = 0, d1 = 0, d2 = 0, shift = 0, shift1 = 0, shift2 = 0,
783 tmp = 0, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0;
784
785 FX_BYTE *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL;
786
782 if (!m_pData) { 787 if (!m_pData) {
783 return FALSE; 788 return FALSE;
784 } 789 }
785 if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) { 790 if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) {
786 return FALSE; 791 return FALSE;
787 } 792 }
788 if(y < 0) { 793 if(y < 0) {
789 ys0 = -y; 794 ys0 = -y;
790 } else {
791 ys0 = 0;
792 } 795 }
793 if(y + m_nHeight > pDst->m_nHeight) { 796 if(y + m_nHeight > pDst->m_nHeight) {
794 ys1 = pDst->m_nHeight - y; 797 ys1 = pDst->m_nHeight - y;
795 } else { 798 } else {
796 ys1 = m_nHeight; 799 ys1 = m_nHeight;
797 } 800 }
798 if(x < 0) { 801 if(x < 0) {
799 xs0 = -x; 802 xs0 = -x;
800 } else {
801 xs0 = 0;
802 } 803 }
803 if(x + m_nWidth > pDst->m_nWidth) { 804 if(x + m_nWidth > pDst->m_nWidth) {
804 xs1 = pDst->m_nWidth - x; 805 xs1 = pDst->m_nWidth - x;
805 } else { 806 } else {
806 xs1 = m_nWidth; 807 xs1 = m_nWidth;
807 } 808 }
808 if((ys0 >= ys1) || (xs0 >= xs1)) { 809 if((ys0 >= ys1) || (xs0 >= xs1)) {
809 return 0; 810 return 0;
810 } 811 }
811 w = xs1 - xs0; 812 w = xs1 - xs0;
812 h = ys1 - ys0; 813 h = ys1 - ys0;
813 if(y < 0) { 814 if(y >= 0) {
814 yd0 = 0;
815 } else {
816 yd0 = y; 815 yd0 = y;
817 } 816 }
818 if(x < 0) { 817 if(x >= 0) {
819 xd0 = 0;
820 } else {
821 xd0 = x; 818 xd0 = x;
822 } 819 }
823 xd1 = xd0 + w; 820 xd1 = xd0 + w;
824 yd1 = yd0 + h; 821 yd1 = yd0 + h;
825 d1 = xd0 & 31; 822 d1 = xd0 & 31;
826 d2 = xd1 & 31; 823 d2 = xd1 & 31;
827 s1 = xs0 & 31; 824 s1 = xs0 & 31;
828 maskL = 0xffffffff >> d1; 825 maskL = 0xffffffff >> d1;
829 maskR = 0xffffffff << ((32 - (xd1 & 31)) % 32); 826 maskR = 0xffffffff << ((32 - (xd1 & 31)) % 32);
830 maskM = maskL & maskR; 827 maskM = maskL & maskR;
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 dp[2] = (FX_BYTE)(tmp >> 8); 1607 dp[2] = (FX_BYTE)(tmp >> 8);
1611 dp[3] = (FX_BYTE)tmp; 1608 dp[3] = (FX_BYTE)tmp;
1612 } 1609 }
1613 lineSrc += m_nStride; 1610 lineSrc += m_nStride;
1614 lineDst += pDst->m_nStride; 1611 lineDst += pDst->m_nStride;
1615 } 1612 }
1616 } 1613 }
1617 } 1614 }
1618 return 1; 1615 return 1;
1619 } 1616 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698