[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Suspicous code in kdelibs-3.5.2
From: "R.F. Pels" <ruurd () tiscali ! nl>
Date: 2006-04-06 17:55:35
Message-ID: 200604061955.36541.ruurd () tiscali ! nl
[Download RAW message or body]
On Thursday 6 April 2006 16.18, Dirk Mueller wrote:
> What is actually missing is somebody fixing the array overrun, and
> the rest please ignore the trolls. Thanks.
If this is about the Bayer Matrix in kpixmap.cpp, I looked at it, and I think
the code can be elided (see other post), but I'm not feeling kde-core hacker
enough to go on and do that. If it cannot be elided, replace with the text in
the attachment. I generated this with the same code as in kpixmap on an i386.
--
R.F. Pels, 3e Rompert 118, 5233 AL 's-Hertogenbosch, The Netherlands
+31736414590 ruurd@tiscali.nl http://home.tiscali.nl/~ruurd
["bayermatrix.cpp" (text/x-c++src)]
/***************************************************************************
* Copyright (C) 2005 by R.F. Pels *
* ruurd@tiscali.nl *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
#include <iomanip>
#include <cstdlib>
using namespace std;
int main(int /*argc*/, char* /*argv*/[])
{
uint foo[2][2] = {{0,1},{1,2}};
uint bm[16][16];
int n, i, j;
bm[0][0]=0;
for (n=1; n<16; n*=2)
{
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
{
bm[i][j]*=4;
bm[i+n][j]=bm[i][j]+2;
bm[i][j+n]=bm[i][j]+3;
bm[i+n][j+n]=bm[i][j]+1;
}
}
}
for (i=0; i<16; i++)
{
for (j=0; j<16; j++)
{
bm[i][j]<<=8;
}
}
cout << "uint bm[16][16] = {" << endl;
for (i = 0; i < 16; i++)
{
if (i > 0)
{
cout << "," << endl;
}
cout << " {";
for (j = 0; j < 16; j++)
{
if (j > 0)
{
cout << ", ";
}
cout << setw(6) << bm[i][j];
}
cout << " }";
}
cout << endl << "};" << endl;
}
["bm.txt" (text/plain)]
uint bm[16][16] = {
{ 0, 49152, 12288, 61440, 3072, 52224, 15360, 64512, 768, 49920, \
13056, 62208, 3840, 52992, 16128, 65280 }, { 32768, 16384, 45056, 28672, \
35840, 19456, 48128, 31744, 33536, 17152, 45824, 29440, 36608, 20224, \
48896, 32512 }, { 8192, 57344, 4096, 53248, 11264, 60416, 7168, 56320, \
8960, 58112, 4864, 54016, 12032, 61184, 7936, 57088 }, { 40960, 24576, \
36864, 20480, 44032, 27648, 39936, 23552, 41728, 25344, 37632, 21248, \
44800, 28416, 40704, 24320 }, { 2048, 51200, 14336, 63488, 1024, 50176, \
13312, 62464, 2816, 51968, 15104, 64256, 1792, 50944, 14080, 63232 }, { \
34816, 18432, 47104, 30720, 33792, 17408, 46080, 29696, 35584, 19200, \
47872, 31488, 34560, 18176, 46848, 30464 }, { 10240, 59392, 6144, 55296, \
9216, 58368, 5120, 54272, 11008, 60160, 6912, 56064, 9984, 59136, 5888, \
55040 }, { 43008, 26624, 38912, 22528, 41984, 25600, 37888, 21504, 43776, \
27392, 39680, 23296, 42752, 26368, 38656, 22272 }, { 512, 49664, 12800, \
61952, 3584, 52736, 15872, 65024, 256, 49408, 12544, 61696, 3328, \
52480, 15616, 64768 }, { 33280, 16896, 45568, 29184, 36352, 19968, 48640, \
32256, 33024, 16640, 45312, 28928, 36096, 19712, 48384, 32000 }, { 8704, \
57856, 4608, 53760, 11776, 60928, 7680, 56832, 8448, 57600, 4352, \
53504, 11520, 60672, 7424, 56576 }, { 41472, 25088, 37376, 20992, 44544, \
28160, 40448, 24064, 41216, 24832, 37120, 20736, 44288, 27904, 40192, 23808 \
}, { 2560, 51712, 14848, 64000, 1536, 50688, 13824, 62976, 2304, 51456, \
14592, 63744, 1280, 50432, 13568, 62720 }, { 35328, 18944, 47616, 31232, \
34304, 17920, 46592, 30208, 35072, 18688, 47360, 30976, 34048, 17664, \
46336, 29952 }, { 10752, 59904, 6656, 55808, 9728, 58880, 5632, 54784, \
10496, 59648, 6400, 55552, 9472, 58624, 5376, 54528 }, { 43520, 27136, \
39424, 23040, 42496, 26112, 38400, 22016, 43264, 26880, 39168, 22784, \
42240, 25856, 38144, 21760 } };
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic