[llvm-commits] [llvm] r155661 - /llvm/trunk/runtime/libprofile/CommonProfiling.c
James Molloy
james.molloy at arm.com
Fri Apr 27 05:54:16 PDT 2012
Hi Ted,
This commit causes our build to fail because of the use of C++ style
comments in a file compiled for C90.
Could you please change to C-style comments?
Cheers,
James
-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Ted Kremenek
Sent: 26 April 2012 21:54
To: llvm-commits at cs.uiuc.edu
Subject: [llvm-commits] [llvm] r155661 -
/llvm/trunk/runtime/libprofile/CommonProfiling.c
Author: kremenek
Date: Thu Apr 26 15:54:27 2012
New Revision: 155661
URL: http://llvm.org/viewvc/llvm-project?rev=155661&view=rev
Log:
Defensively guard against calling malloc() with a size of zero.
Modified:
llvm/trunk/runtime/libprofile/CommonProfiling.c
Modified: llvm/trunk/runtime/libprofile/CommonProfiling.c
URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/CommonProf
iling.c?rev=155661&r1=155660&r2=155661&view=diff
============================================================================
==
--- llvm/trunk/runtime/libprofile/CommonProfiling.c (original)
+++ llvm/trunk/runtime/libprofile/CommonProfiling.c Thu Apr 26 15:54:27 2012
@@ -65,6 +65,15 @@
for (Length = 0, i = 0; i != (unsigned)argc; ++i)
Length += strlen(argv[i])+1;
+ // Defensively check for a zero length, even though this is unlikely
+ // to happen in practice. This avoids calling malloc() below with a
+ // size of 0.
+ if (Length == 0) {
+ SavedArgs = 0;
+ SavedArgsLength = 0;
+ return argc;
+ }
+
SavedArgs = (char*)malloc(Length);
for (Length = 0, i = 0; i != (unsigned)argc; ++i) {
unsigned Len = strlen(argv[i]);
_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list