[pso] bug utilitar formatare

Cibu Cristian pso@cursuri.cs.pub.ro
Sat, 5 Jun 2004 19:12:34 +0300


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C44B31.0E80F6B0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<linux>

char buffer[4096];=20
....
switch (block_size) {
  case 512:
   bits=3D9;
   break;
  case 1024:
   bits=3D10;
   break;
  case 2048:
   bits=3D11;
   break;
  case 4096:        =
//<=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
   bits=3D12;
   break;
  default:
   return -1;
 }=20
...

buffer[block_size]=3D0x80;
 fwrite(buffer, 4096, 1, file);=20
....

deci block_size poate fi si 4096. buffer[4096] =3D teoretic crash.
ca sa nu mai vorbim de faptul ca fwrite nu va scrie nimic in Dmap...
------=_NextPart_000_0007_01C44B31.0E80F6B0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>&lt;linux&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>char buffer[4096]; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>switch (block_size) =
{<BR>&nbsp;&nbsp;case=20
512:<BR>&nbsp;&nbsp;&nbsp;bits=3D9;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;=
&nbsp;case=20
1024:<BR>&nbsp;&nbsp;&nbsp;bits=3D10;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbs=
p;&nbsp;case=20
2048:<BR>&nbsp;&nbsp;&nbsp;bits=3D11;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbs=
p;&nbsp;case=20
4096:&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
//&lt;=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
<BR>&nbsp;&nbsp;&nbsp;bits=3D12;<BR>&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nb=
sp;default:<BR>&nbsp;&nbsp;&nbsp;return=20
-1;<BR>&nbsp;} </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial =
size=3D2>buffer[block_size]=3D0x80;<BR>&nbsp;fwrite(buffer,=20
4096, 1, file); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>....</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>deci block_size poate fi si 4096. =
buffer[4096] =3D=20
teoretic crash.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ca sa nu mai vorbim de faptul ca fwrite =
nu va scrie=20
nimic in Dmap...</FONT></DIV></BODY></HTML>

------=_NextPart_000_0007_01C44B31.0E80F6B0--