Re: [msysGit] Re: [PATCH 01/14] Fix non-constant array creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Janos Laube said the following on 21.08.2009 18:26:
MSVC compiles regex.c, so it must handle it. I'm fine with that.

msvc supports alloca, but regex.c doesn't make use of it per default (you must define HAVE_ALLOCA_H in order to use it). basically _alloca
 is fine for that task, but be aware that error handling on windows
is a bit compilicated. when _alloca fails it throws a structured exception, you must reset the stack and use traditional memory allocation as fallback. see http://msdn.microsoft.com/en-us/library/wb1s57t5.aspx. :-)

I must admit that I didn't look much at the surrounding code to know how large preimage->nr can get. But assuming variable-length array is handled the same way by the compiler as alloca(), and this code seems to be performing fine, I guess it's safe to say that this code won't be triggering any SEH, and thus we won't need to handle it?

So, given my assumptions I think we can just replace that one line with alloca(), nuke the free(), and everything is ok.

--
.marius
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]