Bug 207134

Summary: graphics/libfpx: fix build with clang 3.8.0
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: mi, mi
Priority: --- Flags: bugzilla: maintainer-feedback? (mi)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 206074    
Description Flags
Fix infinite loop in libfpx's EB_Copy_To_Memory() function mi: maintainer-approval-

Description Dimitry Andric freebsd_committer 2016-02-12 18:15:15 UTC
Created attachment 166903 [details]
Fix infinite loop in libfpx's EB_Copy_To_Memory() function

During a recent exp-run for bug 206074, it was found that graphics/libfpx gives errors with clang 3.8.0:

/wrkdirs/usr/ports/graphics/libfpx/work/libfpx-1.3.1-4/jpeg/ebuffer.c:94:36: error: variables 'i' and 'num' used in loop condition not modified in loop body [-Werror,-Wfor-loop-analysis]
  for(i=0,mem_ptr=mem,buf_ptr=buf; i < num ;*mem_ptr++=*buf_ptr++);
                                   ^   ~~~

This for loop, in the EB_Copy_To_Memory() function, is non-terminating, since it never increases its counter.  The attached patch fixes this.

[1] http://package22.nyi.freebsd.org/data/headamd64PR206074-default/2016-02-12_13h52m56s/logs/errors/libfpx-
Comment 1 Mikhail Teterin freebsd_committer 2016-02-17 04:30:18 UTC
Comment on attachment 166903 [details]
Fix infinite loop in libfpx's EB_Copy_To_Memory() function

I'd like to look deeper -- how could this code have ever worked? And, if it was never, actually, exercised, simply remove it altogether, instead of dressing it up...
Comment 2 commit-hook freebsd_committer 2016-02-19 03:17:24 UTC
A commit references this bug:

Author: mi
Date: Fri Feb 19 03:16:43 UTC 2016
New revision: 409147
URL: https://svnweb.freebsd.org/changeset/ports/409147

  Add a patch to get rid of some dead code, which triggers a
  warning when compiled with clang-3.8. Bump PORTREVISION.

  PR:		207134