mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
Add a sanity check of files include by .incbin.
PR 27381 * read.c (s_incbin): Check that the file to be included is a regular, non-directory file. * testsuite/gas/all/pr27381.s: New test source file. * testsuite/gas/all/pr27381.d: New test control file. * testsuite/gas/all/pr27381.err: Expected error output for the new test. * testsuite/gas/all/gas.exp: Run the new test.
This commit is contained in:
@ -1,3 +1,13 @@
|
||||
2021-02-09 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR 27381
|
||||
* read.c (s_incbin): Check that the file to be included is a
|
||||
regular, non-directory file.
|
||||
* testsuite/gas/all/pr27381.s: New test source file.
|
||||
* testsuite/gas/all/pr27381.d: New test control file.
|
||||
* testsuite/gas/all/pr27381.err: Expected error output for the new test.
|
||||
* testsuite/gas/all/gas.exp: Run the new test.
|
||||
|
||||
2021-02-09 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* Makefile.am (TARG_ENV_HFILES): Remove config/te-symbian.h.
|
||||
|
@ -5909,7 +5909,16 @@ s_incbin (int x ATTRIBUTE_UNUSED)
|
||||
if (binfile)
|
||||
{
|
||||
long file_len;
|
||||
struct stat filestat;
|
||||
|
||||
if (fstat (fileno (binfile), &filestat) != 0
|
||||
|| ! S_ISREG (filestat.st_mode)
|
||||
|| S_ISDIR (filestat.st_mode))
|
||||
{
|
||||
as_bad (_("unable to include `%s'"), path);
|
||||
goto done;
|
||||
}
|
||||
|
||||
register_dependency (path);
|
||||
|
||||
/* Compute the length of the file. */
|
||||
|
@ -470,3 +470,4 @@ gas_test "pr23938.s" "" "" ".xstabs"
|
||||
run_dump_test "nop"
|
||||
run_dump_test "asciz"
|
||||
run_dump_test "pr27384"
|
||||
run_dump_test "pr27381"
|
||||
|
4
gas/testsuite/gas/all/pr27381.d
Normal file
4
gas/testsuite/gas/all/pr27381.d
Normal file
@ -0,0 +1,4 @@
|
||||
#as:
|
||||
#error_output: pr27381.err
|
||||
# The TI targets do not support the .incbin directuve.
|
||||
#notarget: tic*-*-*
|
2
gas/testsuite/gas/all/pr27381.err
Normal file
2
gas/testsuite/gas/all/pr27381.err
Normal file
@ -0,0 +1,2 @@
|
||||
.*pr27381.s: Assembler messages:
|
||||
.*pr27381.s:1: Error: unable to include `/etc/'
|
1
gas/testsuite/gas/all/pr27381.s
Normal file
1
gas/testsuite/gas/all/pr27381.s
Normal file
@ -0,0 +1 @@
|
||||
.incbin "/etc/"
|
Reference in New Issue
Block a user