ed-1.20.2-1.fc41

List of Defects

Error: CPPCHECK_WARNING: [#def1]
ed-1.20.2-build/ed-1.20.2/buffer.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-416): [#def2]
ed-1.20.2-build/ed-1.20.2/buffer.c:71:39: warning[-Wanalyzer-use-after-free]: use after ‘free’ of ‘yank_buffer_head.q_forw’
ed-1.20.2-build/ed-1.20.2/buffer.c: scope_hint: In function ‘yank_lines’
ed-1.20.2-build/ed-1.20.2/buffer.c: scope_hint: In function ‘yank_lines’
#   69|   /* link next and previous nodes */
#   70|   static void link_nodes( line_t * const prev, line_t * const next )
#   71|->   { prev->q_forw = next; next->q_back = prev; }
#   72|   
#   73|   

Error: CPPCHECK_WARNING: [#def3]
ed-1.20.2-build/ed-1.20.2/carg_parser.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-131): [#def4]
ed-1.20.2-build/ed-1.20.2/global.c: scope_hint: In function ‘set_active_node’
ed-1.20.2-build/ed-1.20.2/global.c:74:17: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size
#   72|           set_error_msg( mem_msg ); enable_interrupts(); return false; }
#   73|       active_size = new_size;
#   74|->     active_list = (const line_t **)new_buf;
#   75|       enable_interrupts();
#   76|       }

Error: CLANG_WARNING: [#def5]
ed-1.20.2-build/ed-1.20.2/global.c:94:10: warning[core.NullDereference]: Access to field 'q_forw' results in a dereference of a null pointer (loaded from variable 'bp')
#   92|           { active_list[active_idxm] = 0; break; }
#   93|         }
#   94|->     bp = bp->q_forw;
#   95|       }
#   96|     }

Error: CPPCHECK_WARNING: [#def6]
ed-1.20.2-build/ed-1.20.2/io.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-762): [#def7]
ed-1.20.2-build/ed-1.20.2/io.c: scope_hint: In function ‘read_file’
ed-1.20.2-build/ed-1.20.2/io.c:295:57: warning[-Wanalyzer-mismatching-deallocation]: ‘fp’ should have been deallocated with ‘pclose’ but was deallocated with ‘fclose’
#  293|         set_error_msg( "Cannot open input file" ); return -1; }
#  294|     const long size = read_stream( filename, fp, addr );	/* file size in bytes */
#  295|->   if( *filename == '!' ) ret = pclose( fp ); else ret = fclose( fp );
#  296|     if( size < 0 ) return -2;
#  297|     if( ret != 0 )

Error: GCC_ANALYZER_WARNING (CWE-762): [#def8]
ed-1.20.2-build/ed-1.20.2/io.c: scope_hint: In function ‘write_file’
ed-1.20.2-build/ed-1.20.2/io.c:351:32: warning[-Wanalyzer-mismatching-deallocation]: ‘fp’ should have been deallocated with ‘fclose’ but was deallocated with ‘pclose’
#  349|         set_error_msg( "Cannot open output file" ); return -1; }
#  350|     const long size = write_stream( filename, fp, from, to );	/* bytes written */
#  351|->   if( *filename == '!' ) ret = pclose( fp ); else ret = fclose( fp );
#  352|     if( size < 0 ) return -1;
#  353|     if( ret != 0 )

Error: GCC_ANALYZER_WARNING (CWE-762): [#def9]
ed-1.20.2-build/ed-1.20.2/io.c:351:57: warning[-Wanalyzer-mismatching-deallocation]: ‘fp’ should have been deallocated with ‘pclose’ but was deallocated with ‘fclose’
#  349|         set_error_msg( "Cannot open output file" ); return -1; }
#  350|     const long size = write_stream( filename, fp, from, to );	/* bytes written */
#  351|->   if( *filename == '!' ) ret = pclose( fp ); else ret = fclose( fp );
#  352|     if( size < 0 ) return -1;
#  353|     if( ret != 0 )

Error: GCC_ANALYZER_WARNING (CWE-775): [#def10]
ed-1.20.2-build/ed-1.20.2/io.c:352:5: warning[-Wanalyzer-file-leak]: leak of FILE ‘fp’
#  350|     const long size = write_stream( filename, fp, from, to );	/* bytes written */
#  351|     if( *filename == '!' ) ret = pclose( fp ); else ret = fclose( fp );
#  352|->   if( size < 0 ) return -1;
#  353|     if( ret != 0 )
#  354|       { show_strerror( filename, errno );

Error: CPPCHECK_WARNING: [#def11]
ed-1.20.2-build/ed-1.20.2/main.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def12]
ed-1.20.2-build/ed-1.20.2/main_loop.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def13]
ed-1.20.2-build/ed-1.20.2/regex.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: CPPCHECK_WARNING: [#def14]
ed-1.20.2-build/ed-1.20.2/signal.c: information[normalCheckLevelMaxBranches]: Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.

Error: GCC_ANALYZER_WARNING (CWE-688): [#def15]
ed-1.20.2-build/ed-1.20.2/signal.c: scope_hint: In function ‘home_directory’
ed-1.20.2-build/ed-1.20.2/signal.c:55:5: warning[-Wanalyzer-null-argument]: use of NULL ‘buf’ where non-null expected
ed-1.20.2-build/ed-1.20.2/signal.c:21: included_from: Included from here.
ed-1.20.2-build/ed-1.20.2/signal.c: scope_hint: In function ‘home_directory’
<built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null
#   53|       const int hdsize = strlen( hd );
#   54|       if( !resize_buffer( &buf, &bufsz, hdsize + 1 ) ) return 0;
#   55|->     memcpy( buf, hd, hdsize );
#   56|       buf[hdsize] = 0;
#   57|       }

Error: CLANG_WARNING: [#def16]
ed-1.20.2-build/ed-1.20.2/signal.c:55:5: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull'
#   53|       const int hdsize = strlen( hd );
#   54|       if( !resize_buffer( &buf, &bufsz, hdsize + 1 ) ) return 0;
#   55|->     memcpy( buf, hd, hdsize );
#   56|       buf[hdsize] = 0;
#   57|       }

Error: CLANG_WARNING: [#def17]
ed-1.20.2-build/ed-1.20.2/signal.c:71:14: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value
#   69|         write_file( hb, "w", 1, last_addr() ) >= 0 ) exit( 0 );
#   70|     const char * const hd = home_directory();
#   71|->   if( !hd || !hd[0] ) exit( 1 );
#   72|     const int hdsize = strlen( hd );
#   73|     const int need_slash = hd[hdsize-1] != '/';

Error: GCC_ANALYZER_WARNING (CWE-401): [#def18]
ed-1.20.2-build/ed-1.20.2/signal.c: scope_hint: In function ‘sighup_handler.part.0’
ed-1.20.2-build/ed-1.20.2/signal.c:80:5: warning[-Wanalyzer-malloc-leak]: leak of ‘malloc((long unsigned int)(hdsize + need_slash) + 7)’
ed-1.20.2-build/ed-1.20.2/signal.c: scope_hint: In function ‘sighup_handler.part.0’
#   78|     if( need_slash ) hup[hdsize] = '/';
#   79|     memcpy( hup + hdsize + need_slash, hb, sizeof hb );
#   80|->   if( write_file( hup, "w", 1, last_addr() ) >= 0 ) exit( 0 );
#   81|     exit( 1 );				/* hup file write failed */
#   82|     }

Scan Properties

analyzer-version-clang18.1.7
analyzer-version-cppcheck2.14.2
analyzer-version-gcc14.1.1
analyzer-version-gcc-analyzer14.1.1
analyzer-version-shellcheck0.10.0
enabled-pluginsclang, cppcheck, gcc, shellcheck
exit-code0
hostip-172-16-1-217.us-west-2.compute.internal
mock-configfedora-41-x86_64
project-nameed-1.20.2-1.fc41
store-results-to/tmp/tmpm2vpkzso/ed-1.20.2-1.fc41.tar.xz
time-created2024-07-03 12:30:15
time-finished2024-07-03 12:31:06
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-41-x86_64' '-t' 'cppcheck,gcc,clang,shellcheck' '-o' '/tmp/tmpm2vpkzso/ed-1.20.2-1.fc41.tar.xz' '--gcc-analyze' '/tmp/tmpm2vpkzso/ed-1.20.2-1.fc41.src.rpm'
tool-versioncsmock-3.5.3-1.el9