This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix undefined behavior, don't pass NULL to fwrite


*** TEST RESULTS FOR COMMIT 1f88d0c87c37d3a15fa6376335e8b0d1c79d85aa ***

Author: Simon Marchi <simon.marchi@ericsson.com>
Branch: master
Commit: 1f88d0c87c37d3a15fa6376335e8b0d1c79d85aa

Fix undefined behavior, don't pass NULL to fwrite

If a vector that we try to write using file_write is empty, we may end
up passing NULL to fwrite, which triggers UBSan:

  .../gdb/dwarf-index-write.c:73:14: runtime error: null pointer passed as argument 1, which is declared to never be null

Avoid it by skipping the write if the vector is empty.

gdb/ChangeLog:

	* dwarf-index-write.c (file_write): Don't write if the vector is
	empty.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]