Do you have a sample source file plus cfg which could be added to the test set? (I'm working [very slowly] on a comment reformatter patch for uncrustify, so would appreciate extra test material to put that bugger through its paces once it's beyond the 'it's a mess' stage - particularly test samples which caused trouble in the past. ;-) )

Your patch sounds good to me; only for caution's sake, I'd write the extra check as 'line_len > 0', 's all.


On Wed, Jan 27, 2010 at 3:25 PM, Dave Carlton <lists@polymicrosystems.com> wrote:
While running uncrustify over my sources last night I kept getting a crash and traced down to output_comment_multi where it was checking for comment characters. The var line_len was 0 which was causing the crash. I changed the source as in the patch and it seems to work, don't know if this is totally correct, so if some uncrustify expert could verify and roll in the change.

--- /Users/davec/Library/Caches/Cornerstone/Store/https%3A%2F%2Funcrustify.svn.sourceforge.net%2Fsvnroot%2Funcrustify/0000001636/trunk/uncrustify/src/output.cpp        Mon Oct 12 19:59:37 2009
+++ /Users/davec/Sources/SVN/uncrustify/src/output.cpp  Tue Jan 26 15:56:49 2010
@@ -1225,7 +1225,7 @@
            {
               line_len--;
            }
-            if ((line[line_len - 1] == '\\') && (line[line_len - 2] != '*'))
+            if ( (line_len != 0) && (line[line_len - 1] == '\\') && (line[line_len - 2] != '*'))
            {
               if (pc->flags & PCF_IN_PREPROC)
               {


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Uncrustify-developer mailing list
Uncrustify-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/uncrustify-developer



--
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web:    http://www.hobbelt.com/
       http://www.hebbut.net/
mail:   ger@hobbelt.com
mobile: +31-6-11 120 978
--------------------------------------------------