Magellan Linux

Contents of /trunk/koffice/patches/post-1.3-koffice-CAN-2005-3193.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 144 - (show annotations) (download)
Tue May 8 20:06:05 2007 UTC (17 years ago) by niro
File size: 2612 byte(s)
-import

1 Index: filters/kword/pdf/xpdf/xpdf/Stream.cc
2 ===================================================================
3 --- filters/kword/pdf/xpdf/xpdf/Stream.cc (revision 485850)
4 +++ filters/kword/pdf/xpdf/xpdf/Stream.cc (revision 486431)
5 @@ -404,18 +404,33 @@ void ImageStream::skipLine() {
6
7 StreamPredictor::StreamPredictor(Stream *strA, int predictorA,
8 int widthA, int nCompsA, int nBitsA) {
9 + int totalBits;
10 +
11 str = strA;
12 predictor = predictorA;
13 width = widthA;
14 nComps = nCompsA;
15 nBits = nBitsA;
16 + predLine = NULL;
17 + ok = gFalse;
18
19 nVals = width * nComps;
20 + totalBits = nVals * nBits;
21 + if ( totalBits == 0 ||
22 + (totalBits / nBits) / nComps != width ||
23 + totalBits + 7 < 0) {
24 + return;
25 + }
26 pixBytes = (nComps * nBits + 7) >> 3;
27 - rowBytes = ((nVals * nBits + 7) >> 3) + pixBytes;
28 + rowBytes = ((totalBits + 7) >> 3) + pixBytes;
29 + if (rowBytes < 0)
30 + return;
31 +
32 predLine = (Guchar *)gmalloc(rowBytes);
33 memset(predLine, 0, rowBytes);
34 predIdx = rowBytes;
35 +
36 + ok = gTrue;
37 }
38
39 StreamPredictor::~StreamPredictor() {
40 @@ -982,6 +997,10 @@ LZWStream::LZWStream(Stream *strA, int p
41 FilterStream(strA) {
42 if (predictor != 1) {
43 pred = new StreamPredictor(this, predictor, columns, colors, bits);
44 + if ( !pred->isOk()) {
45 + delete pred;
46 + pred = NULL;
47 + }
48 } else {
49 pred = NULL;
50 }
51 @@ -2861,6 +2880,10 @@ GBool DCTStream::readBaselineSOF() {
52 height = read16();
53 width = read16();
54 numComps = str->getChar();
55 + if (numComps <= 0 || numComps > 4) {
56 + error(getPos(), "Bad number of components in DCT stream");
57 + return gFalse;
58 + }
59 if (prec != 8) {
60 error(getPos(), "Bad DCT precision %d", prec);
61 return gFalse;
62 @@ -3179,6 +3202,10 @@ FlateStream::FlateStream(Stream *strA, i
63 FilterStream(strA) {
64 if (predictor != 1) {
65 pred = new StreamPredictor(this, predictor, columns, colors, bits);
66 + if ( !pred->isOk()) {
67 + delete pred;
68 + pred = NULL;
69 + }
70 } else {
71 pred = NULL;
72 }
73 Index: filters/kword/pdf/xpdf/xpdf/Stream.h
74 ===================================================================
75 --- filters/kword/pdf/xpdf/xpdf/Stream.h (revision 485850)
76 +++ filters/kword/pdf/xpdf/xpdf/Stream.h (revision 486431)
77 @@ -227,6 +227,7 @@ public:
78
79 int lookChar();
80 int getChar();
81 + GBool isOk() { return ok; }
82
83 private:
84
85 @@ -242,6 +243,7 @@ private:
86 int rowBytes; // bytes per line
87 Guchar *predLine; // line buffer
88 int predIdx; // current index in predLine
89 + GBool ok;
90 };
91
92 //------------------------------------------------------------------------