git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/5] Miscellaneous fixes from static analysis

From
John Keeping <john@keeping.me.uk>
Date
Feb 16, 2014, 16:06 UTC
Message-ID
<cover.1392565571.git.john@keeping.me.uk>

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
Next: John Keeping
Message 1 of 13 in “Miscellaneous fixes from static analysis”
  1. 0/5 Miscellaneous fixes from static analysisJohn Keeping, Feb 16, 2014
  2. 1/5 notes-utils: handle boolean notes.rewritemode correctlyJohn Keeping, Feb 16, 2014
  3. David KastrupFeb 16, 2014
  4. Jeff KingFeb 18, 2014
  5. David KastrupFeb 18, 2014
  6. Jeff KingFeb 18, 2014
  7. David KastrupFeb 18, 2014
  8. 2/5 utf8: fix iconv error detectionJohn Keeping, Feb 16, 2014
  9. 3/5 utf8: use correct type for values in interval tableJohn Keeping, Feb 16, 2014
  10. 4/5 builtin/mv: don't use memory after freeJohn Keeping, Feb 16, 2014
  11. 5/5 streaming: simplify attaching a filterJohn Keeping, Feb 16, 2014
  12. Junio C HamanoFeb 18, 2014
  13. Junio C HamanoFeb 19, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.