[PATCH]Add address overflow check

Ruikai Liu <[email protected]> Fri, 9 Feb 2018 17:42:30 +0800
Newsgroups gmane.comp.audio.compression.speex.devel
Message-ID <CAB6DpjWZSgU_CZJFEi9ENAaKggNFV5LxUo0L5SmXQ0RLey7LTA@mail.gmail.com>
--===============6165458672270225393==
Content-Type: multipart/alternative; boundary="001a11444ecce227a50564c458a3"

--001a11444ecce227a50564c458a3
Content-Type: text/plain; charset="UTF-8"

Hi,

I came into a crash when using 32-bit `speexdec` and found that there's an
address overflow in function `print_comments()`:

static void print_comments(char *comments, int length)

{

   char *c=comments;

   int len, i, nb_fields;

   char *end;


   if (length<8)

   {

      fprintf (stderr, "Invalid/corrupted comments\n");

      return;

   }

   end = c+length;

   len=readint(c, 0);

   c+=4;

// 'c+len' MAY OVERFLOW

   if (len < 0 || c+len>end)

   {

      fprintf (stderr, "Invalid/corrupted comments\n");

      return;

   }


The pointer `c` happened to be greater than `0x80000000` and the sum
overflowed, even though `length` is positive.

Here's the patch code:

*diff --git a/src/speexdec.c b/src/speexdec.c*

*index 4721dc1..18786f1 100644*

*--- a/src/speexdec.c*

*+++ b/src/speexdec.c*

@@ -105,7 +105,7 @@ static void print_comments(char *comments, int length)

    end = c+length;

    len=readint(c, 0);

    c+=4;

-   if (len < 0 || c+len>end)

+   if (len < 0 || c+len>end || c+len<c)

    {

       fprintf (stderr, "Invalid/corrupted comments\n");

       return;

@@ -129,7 +129,7 @@ static void print_comments(char *comments, int length)

       }

       len=readint(c, 0);

       c+=4;

-      if (len < 0 || c+len>end)

+      if (len < 0 || c+len>end || c+len<c)

       {

          fprintf (stderr, "Invalid/corrupted comments\n");

          return;

Thanks!

-- 
Best regards,

Ruikai Liu

--001a11444ecce227a50564c458a3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,</div><div><br></div><div>I came into a crash when=
 using 32-bit `speexdec` and found that there&#39;s an address overflow in =
function `<span style=3D"font-variant-ligatures:no-common-ligatures;backgro=
und-color:rgb(255,253,207);color:rgb(0,0,0);font-family:Menlo;font-size:11p=
x">print_comments()`:</span></div><div><font color=3D"#000000" face=3D"Menl=
o"><span style=3D"font-size:11px;font-variant-ligatures:no-common-ligatures=
"><br></span></font><p class=3D"gmail-p1" style=3D"margin:0px;font-style:no=
rmal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:1=
1px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:=
rgb(255,253,207)"><span class=3D"gmail-s1" style=3D"font-variant-ligatures:=
no-common-ligatures;color:rgb(48,186,35)">static</span><span class=3D"gmail=
-s2" style=3D"font-variant-ligatures:no-common-ligatures"> </span><span cla=
ss=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures;color:r=
gb(48,186,35)">void</span><span class=3D"gmail-s2" style=3D"font-variant-li=
gatures:no-common-ligatures"> print_comments(</span><span class=3D"gmail-s1=
" style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(48,186,35)"=
>char</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-com=
mon-ligatures"> *comments, </span><span class=3D"gmail-s1" style=3D"font-va=
riant-ligatures:no-common-ligatures;color:rgb(48,186,35)">int</span><span c=
lass=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"> len=
gth)</span><br></p><p class=3D"gmail-p1" style=3D"margin:0px;font-style:nor=
mal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11=
px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:r=
gb(255,253,207)"><span class=3D"gmail-s1" style=3D"font-variant-ligatures:n=
o-common-ligatures">
</span></p><p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font=
-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-=
height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,2=
53,207)"><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common=
-ligatures">{</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span></span><sp=
an class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures;c=
olor:rgb(48,186,35)">char</span><span class=3D"gmail-s2" style=3D"font-vari=
ant-ligatures:no-common-ligatures"> *c=3Dcomments;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span></span><sp=
an class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures;c=
olor:rgb(48,186,35)">int</span><span class=3D"gmail-s2" style=3D"font-varia=
nt-ligatures:no-common-ligatures"> len, i, nb_fields;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span></span><sp=
an class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures;c=
olor:rgb(48,186,35)">char</span><span class=3D"gmail-s2" style=3D"font-vari=
ant-ligatures:no-common-ligatures"> *end;</span></p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207);min=
-height:13px"><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-c=
ommon-ligatures"></span><br></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span></span><sp=
an class=3D"gmail-s3" style=3D"font-variant-ligatures:no-common-ligatures;c=
olor:rgb(203,119,33)">if</span><span class=3D"gmail-s2" style=3D"font-varia=
nt-ligatures:no-common-ligatures"> (length&lt;</span><span class=3D"gmail-s=
4" style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(193,53,31)=
">8</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-commo=
n-ligatures">)</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>{<span cla=
ss=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0</span></span></p>
<p class=3D"gmail-p3" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(193,53,31);background-color:rgb(255,253,207)=
"><span class=3D"gmail-s5" style=3D"font-variant-ligatures:no-common-ligatu=
res;color:rgb(0,0,0)"><span class=3D"gmail-Apple-converted-space">=C2=A0 =
=C2=A0 =C2=A0 </span>fprintf (</span><span class=3D"gmail-s2" style=3D"font=
-variant-ligatures:no-common-ligatures">stderr</span><span class=3D"gmail-s=
5" style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">, =
</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-l=
igatures">&quot;Invalid/corrupted comments</span><span class=3D"gmail-s6" s=
tyle=3D"font-variant-ligatures:no-common-ligatures;color:rgb(211,56,209)">\=
n</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-=
ligatures">&quot;</span><span class=3D"gmail-s5" style=3D"font-variant-liga=
tures:no-common-ligatures;color:rgb(0,0,0)">);</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 =C2=A0 </span></=
span><span class=3D"gmail-s3" style=3D"font-variant-ligatures:no-common-lig=
atures;color:rgb(203,119,33)">return</span><span class=3D"gmail-s2" style=
=3D"font-variant-ligatures:no-common-ligatures">;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>}<span cla=
ss=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0</span></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>end =3D c+=
length;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>len=3Dread=
int(c, </span><span class=3D"gmail-s4" style=3D"font-variant-ligatures:no-c=
ommon-ligatures;color:rgb(193,53,31)">0</span><span class=3D"gmail-s2" styl=
e=3D"font-variant-ligatures:no-common-ligatures">);<span class=3D"gmail-App=
le-converted-space">=C2=A0</span></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>c+=3D</spa=
n><span class=3D"gmail-s4" style=3D"font-variant-ligatures:no-common-ligatu=
res;color:rgb(193,53,31)">4</span><span class=3D"gmail-s2" style=3D"font-va=
riant-ligatures:no-common-ligatures">;</span></p><p class=3D"gmail-p1" styl=
e=3D"margin:0px;font-style:normal;font-variant:normal;font-weight:normal;fo=
nt-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color=
:rgb(0,0,0);background-color:rgb(255,253,207)"><span class=3D"gmail-s2" sty=
le=3D"font-variant-ligatures:no-common-ligatures">// &#39;c+len&#39; MAY OV=
ERFLOW</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span></span><sp=
an class=3D"gmail-s3" style=3D"font-variant-ligatures:no-common-ligatures;c=
olor:rgb(203,119,33)">if</span><span class=3D"gmail-s2" style=3D"font-varia=
nt-ligatures:no-common-ligatures"> (len &lt; </span><span class=3D"gmail-s4=
" style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(193,53,31)"=
>0</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common=
-ligatures"> || c+len&gt;end)</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>{<span cla=
ss=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0</span></span></p>
<p class=3D"gmail-p3" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(193,53,31);background-color:rgb(255,253,207)=
"><span class=3D"gmail-s5" style=3D"font-variant-ligatures:no-common-ligatu=
res;color:rgb(0,0,0)"><span class=3D"gmail-Apple-converted-space">=C2=A0 =
=C2=A0 =C2=A0 </span>fprintf (</span><span class=3D"gmail-s2" style=3D"font=
-variant-ligatures:no-common-ligatures">stderr</span><span class=3D"gmail-s=
5" style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0)">, =
</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-l=
igatures">&quot;Invalid/corrupted comments</span><span class=3D"gmail-s6" s=
tyle=3D"font-variant-ligatures:no-common-ligatures;color:rgb(211,56,209)">\=
n</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-=
ligatures">&quot;</span><span class=3D"gmail-s5" style=3D"font-variant-liga=
tures:no-common-ligatures;color:rgb(0,0,0)">);</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 =C2=A0 </span></=
span><span class=3D"gmail-s3" style=3D"font-variant-ligatures:no-common-lig=
atures;color:rgb(203,119,33)">return</span><span class=3D"gmail-s2" style=
=3D"font-variant-ligatures:no-common-ligatures">;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 </span>}</span></=
p><p></p>


</div><div><br></div><div>The pointer `c` happened to be greater than `0x80=
000000` and the sum overflowed, even though `length` is positive.</div><div=
><br></div><div>Here&#39;s the patch code:</div><div><br></div><div>




<span></span>





<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><b>diff --git a/src/speexdec.c b/src/speexdec.c</b></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><b>index 4721dc1..18786f1 100644</b></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><b>--- a/src/speexdec.c</b></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><b>+++ b/src/speexdec.c</b></span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures;=
color:rgb(48,184,197)">@@ -105,7 +105,7 @@</span><span class=3D"gmail-s1" s=
tyle=3D"font-variant-ligatures:no-common-ligatures"> static void print_comm=
ents(char *comments, int length)</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 </span>end =3D c=
+length;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 </span>len=3Drea=
dint(c, 0);</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 </span>c+=3D4;</=
span></p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(193,53,31);background-color:rgb(255,253,207)=
"><span class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatu=
res">- <span class=3D"gmail-Apple-converted-space">=C2=A0 </span>if (len &l=
t; 0 || c+len&gt;end)</span></p>
<p class=3D"gmail-p3" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(48,186,35);background-color:rgb(255,253,207)=
"><span class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatu=
res">+ <span class=3D"gmail-Apple-converted-space">=C2=A0 </span>if (len &l=
t; 0 || c+len&gt;end || c+len&lt;c)</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 </span>{</span><=
/p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 =C2=A0 =C2=A0 </s=
pan>fprintf (stderr, &quot;Invalid/corrupted comments\n&quot;);</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 =C2=A0 =C2=A0 </s=
pan>return;</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-ligatures;=
color:rgb(48,184,197)">@@ -129,7 +129,7 @@</span><span class=3D"gmail-s1" s=
tyle=3D"font-variant-ligatures:no-common-ligatures"> static void print_comm=
ents(char *comments, int length)</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 =C2=A0 =C2=A0 </s=
pan>}</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 =C2=A0 =C2=A0 </s=
pan>len=3Dreadint(c, 0);</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 =C2=A0 =C2=A0 </s=
pan>c+=3D4;</span></p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(193,53,31);background-color:rgb(255,253,207)=
"><span class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatu=
res">-<span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 =C2=A0 </sp=
an>if (len &lt; 0 || c+len&gt;end)</span></p>
<p class=3D"gmail-p3" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(48,186,35);background-color:rgb(255,253,207)=
"><span class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatu=
res">+<span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 =C2=A0 </sp=
an>if (len &lt; 0 || c+len&gt;end || c+len&lt;c)</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0=C2=A0 =C2=A0 =C2=A0 </s=
pan>{</span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span>fprintf (stderr, &quot;Invalid/corrupted comments\n&quot;);</=
span></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,253,207)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures"=
><span class=3D"gmail-Apple-converted-space">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span>return;</span></p>


<br></div><div>Thanks!</div><div><br></div>-- <br><div class=3D"gmail_signa=
ture" data-smartmail=3D"gmail_signature">Best regards,<br><br>Ruikai Liu<br=
></div>
</div>

--001a11444ecce227a50564c458a3--

--===============6165458672270225393==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KU3BlZXgtZGV2
IG1haWxpbmcgbGlzdApTcGVleC1kZXZAeGlwaC5vcmcKaHR0cDovL2xpc3RzLnhpcGgub3JnL21h
aWxtYW4vbGlzdGluZm8vc3BlZXgtZGV2Cg==

--===============6165458672270225393==--