<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How not to fix buffer overflows</title>
	<atom:link href="http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/feed/" rel="self" type="application/rss+xml" />
	<link>http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/</link>
	<description>Little boxes made of words, by Jens Alfke</description>
	<lastBuildDate>Sun, 02 May 2010 05:43:47 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: evan (LJ)</title>
		<link>http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/comment-page-1/#comment-2090</link>
		<dc:creator>evan (LJ)</dc:creator>
		<pubDate>Tue, 17 Jul 2007 21:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2007/07/how-not-to-fix-buffer-overflows/#comment-2090</guid>
		<description>There is no &quot;rethink&quot;, there is only &quot;run screaming in terror&quot;.  Seriously, it&#039;s known Bad Software.</description>
		<content:encoded><![CDATA[<p>There is no &#8220;rethink&#8221;, there is only &#8220;run screaming in terror&#8221;.  Seriously, it&#8217;s known Bad Software.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Alfke</title>
		<link>http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/comment-page-1/#comment-2089</link>
		<dc:creator>Jens Alfke</dc:creator>
		<pubDate>Tue, 17 Jul 2007 05:25:51 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2007/07/how-not-to-fix-buffer-overflows/#comment-2089</guid>
		<description>With gcc you need to explicitly enable the signed-unsigned-assignment warning ... and I wouldn&#039;t be surprised if PHP spews out tons of warnings as it builds (too much code I&#039;ve seen does. I always build with warnings=errors.)</description>
		<content:encoded><![CDATA[<p>With gcc you need to explicitly enable the signed-unsigned-assignment warning &#8230; and I wouldn&#8217;t be surprised if PHP spews out tons of warnings as it builds (too much code I&#8217;ve seen does. I always build with warnings=errors.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fluffy</title>
		<link>http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/comment-page-1/#comment-2088</link>
		<dc:creator>fluffy</dc:creator>
		<pubDate>Tue, 17 Jul 2007 04:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2007/07/how-not-to-fix-buffer-overflows/#comment-2088</guid>
		<description>That reminds me of one time when I was a judge at the local ACM programming contest.  One of the questions was to write a program to compute the Nth Fibonacci number - with the twist that N could be pretty large (so F(n) would have been greater than MAX_LONG).  One of the teams of course did a naive implementation and when they found they had overflow problems, they switched to using longs - but that still wasn&#039;t enough for some of the test cases, so they switched to doubles.  When that failed to work they complained about how our compilers were &quot;broken&quot; and refused to accept that they didn&#039;t get that problem right.

Finally during the awards ceremony (when they staged a little protest) one of the other judges and I explained the difference between magnitude and precision and they were sufficiently shamed/embarrassed.

The fact that PHP makes the same CS101 mistake, however... holy fucking ugh.</description>
		<content:encoded><![CDATA[<p>That reminds me of one time when I was a judge at the local ACM programming contest.  One of the questions was to write a program to compute the Nth Fibonacci number - with the twist that N could be pretty large (so F(n) would have been greater than MAX_LONG).  One of the teams of course did a naive implementation and when they found they had overflow problems, they switched to using longs - but that still wasn&#8217;t enough for some of the test cases, so they switched to doubles.  When that failed to work they complained about how our compilers were &#8220;broken&#8221; and refused to accept that they didn&#8217;t get that problem right.</p>
<p>Finally during the awards ceremony (when they staged a little protest) one of the other judges and I explained the difference between magnitude and precision and they were sufficiently shamed/embarrassed.</p>
<p>The fact that PHP makes the same CS101 mistake, however&#8230; holy fucking ugh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rpkrajewski (LJ)</title>
		<link>http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/comment-page-1/#comment-2087</link>
		<dc:creator>rpkrajewski (LJ)</dc:creator>
		<pubDate>Tue, 17 Jul 2007 03:38:52 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2007/07/how-not-to-fix-buffer-overflows/#comment-2087</guid>
		<description>I saw the link in your del.icio.us link, and was aghast. For once my smug prejudices were roundly confirmed.

One thing puzzles me, though. calloc&#039;s parameters are size_t&#039;s, not int&#039;s. The size_t type by its nature is unsigned. A strict compiler should warn about trying to fit a signed quantity in the space of the unsigned one when the bit widths of both are the same. (Conversions like unsigned char to signed int are perfectly OK, though; signed to unsigned conversions are never safe.) Even if PHP does not have unsigned int types at the interpreter level, it would seem like you would want to sanitize the integer parameters higher up in the &quot;chunk&quot; routine (i.e., where negative nunbers are already nonsense). At low levels, you could sanity check memory allocations checking against SIZE_MAX (Google around for it).

[Please delete my first empty comment.]</description>
		<content:encoded><![CDATA[<p>I saw the link in your del.icio.us link, and was aghast. For once my smug prejudices were roundly confirmed.</p>
<p>One thing puzzles me, though. calloc&#8217;s parameters are size_t&#8217;s, not int&#8217;s. The size_t type by its nature is unsigned. A strict compiler should warn about trying to fit a signed quantity in the space of the unsigned one when the bit widths of both are the same. (Conversions like unsigned char to signed int are perfectly OK, though; signed to unsigned conversions are never safe.) Even if PHP does not have unsigned int types at the interpreter level, it would seem like you would want to sanitize the integer parameters higher up in the &#8220;chunk&#8221; routine (i.e., where negative nunbers are already nonsense). At low levels, you could sanity check memory allocations checking against SIZE_MAX (Google around for it).</p>
<p>[Please delete my first empty comment.]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rpkrajewski (LJ)</title>
		<link>http://jens.mooseyard.com/2007/07/how-not-to-fix-buffer-overflows/comment-page-1/#comment-2086</link>
		<dc:creator>rpkrajewski (LJ)</dc:creator>
		<pubDate>Tue, 17 Jul 2007 03:23:13 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2007/07/how-not-to-fix-buffer-overflows/#comment-2086</guid>
		<description></description>
		<content:encoded><![CDATA[]]></content:encoded>
	</item>
</channel>
</rss>
