Pages

15 April 2013

The default code differencing / compare tool in Visual Studio 2010 contains a bug: lines of code over 4095 characters overrun the buffer and are not evaluated, nor do they appear. What concerns me is that the compare tool did not alert the user that a buffer overrun may have occurred.

Today, my colleague noticed a line of edited code missing from the default VS2010 code differencing / compare tool, used to locate changes in source controlled files. The edited line of code simply did not appear in the tool, and had no indication of containing a change.

Looking at the code in the editor, I noticed it was a wide line. Very wide. 5057 characters wide, to be exact. The code in question was produced by a meat grinder conversion of a legacy system, not only evidenced by this wide line of code, but also that this line was a call to a method that contains 218 input parameters. (Yes, the application actually runs.)

Inserting a line break after character 4095 confirmed this is a buffer overrun issue; breaking the line at character 4095 causes both lines to appear in the comparison tool, and to be marked as a change.

Subscriptions

Search the Curly Brace

About Me

Mike is a software craftsman in Salt Lake City, Utah (USA) who enjoys being with his family, having fun, having fun while programming, and building stuff. The more geeky it is, the more fun it is to build.