git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Miscellaneous fixes from static analysis
@ 2014-02-16 16:06 John Keeping
  2014-02-16 16:06 ` [PATCH 1/5] notes-utils: handle boolean notes.rewritemode correctly John Keeping
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: John Keeping @ 2014-02-16 16:06 UTC (permalink / raw)
  To: git; +Cc: John Keeping

The first two of these fix real bugs, the rest just clean up some of the
less obviously "not actually a problem" issues identified by Clang's
static analyzer [1] and stack[2].

Stack is interesting in that it is designed to detect potentially
undesirable optimizations where undefined behaviour may be being invoked
unwittingly.  It only detected two error's in git.git, the first of
which is fixed by the final patch.  The second it describes as:

	bug: anti-algebra
	model: |
	  %11 = icmp ult i8* %extra_args, %7, !dbg !342
	  -->  %10 = icmp slt i64 %9, 0, !dbg !342
	  ************************************************************
	  %extra_args <u ((sext i32 %buflen to i64) + %extra_args)<nsw>
	  -->  (-1 * (sext i32 %buflen to i64)) <s 0
	stack: 
	  - daemon.c:522:0
	ncore: 1
	core: 
	  - daemon.c:520:0
	    - pointer overflow

which shows that Clang has converted (simplifying from daemon.c:520):

	char *end = extra_args + buflen;
	if (extra_args < end)

into:

	if (buflen < 0)

This doesn't look like it can ever be subject to pointer overflow, so I
have not considered the churn worth it here.


[1] http://clang-analyzer.llvm.org/
[2] https://github.com/xiw/stack

John Keeping (5):
  notes-utils: handle boolean notes.rewritemode correctly
  utf8: fix iconv error detection
  utf8: use correct type for values in interval table
  builtin/mv: don't use memory after free
  streaming: simplify attaching a filter

 builtin/mv.c  | 3 ++-
 notes-utils.c | 2 +-
 streaming.c   | 5 +----
 utf8.c        | 6 +++---
 4 files changed, 7 insertions(+), 9 deletions(-)

-- 
1.9.rc0.187.g6292fff

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-02-19  0:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-16 16:06 [PATCH 0/5] Miscellaneous fixes from static analysis John Keeping
2014-02-16 16:06 ` [PATCH 1/5] notes-utils: handle boolean notes.rewritemode correctly John Keeping
2014-02-16 16:22   ` David Kastrup
2014-02-18  7:46     ` Jeff King
2014-02-18  8:41       ` David Kastrup
2014-02-18  9:01         ` Jeff King
2014-02-18  9:36           ` David Kastrup
2014-02-16 16:06 ` [PATCH 2/5] utf8: fix iconv error detection John Keeping
2014-02-16 16:06 ` [PATCH 3/5] utf8: use correct type for values in interval table John Keeping
2014-02-16 16:06 ` [PATCH 4/5] builtin/mv: don't use memory after free John Keeping
2014-02-16 16:06 ` [PATCH 5/5] streaming: simplify attaching a filter John Keeping
2014-02-18 23:56   ` Junio C Hamano
2014-02-19  0:02     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).