mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-29 06:50:32 +00:00
Before casting a pointer into an integer field, verify that the field is
wide enough to hold it.
This commit is contained in:
parent
2c3b9e4714
commit
c48ff89fe1
14
bfd/aoutx.h
14
bfd/aoutx.h
@ -1111,7 +1111,14 @@ DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd, statep),
|
|||||||
/* This symbol is the text of a warning message, the next symbol
|
/* This symbol is the text of a warning message, the next symbol
|
||||||
is the symbol to associate the warning with */
|
is the symbol to associate the warning with */
|
||||||
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING;
|
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_WARNING;
|
||||||
|
|
||||||
|
/* @@ Stuffing pointers into integers is a no-no.
|
||||||
|
We can usually get away with it if the integer is
|
||||||
|
large enough though. */
|
||||||
|
if (sizeof (cache_ptr + 1) > sizeof (bfd_vma))
|
||||||
|
abort ();
|
||||||
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
||||||
|
|
||||||
/* We furgle with the next symbol in place.
|
/* We furgle with the next symbol in place.
|
||||||
We don't want it to be undefined, we'll trample the type */
|
We don't want it to be undefined, we'll trample the type */
|
||||||
(sym_pointer + 1)->e_type[0] = 0xff;
|
(sym_pointer + 1)->e_type[0] = 0xff;
|
||||||
@ -1125,6 +1132,13 @@ DEFUN (translate_from_native_sym_flags, (sym_pointer, cache_ptr, abfd, statep),
|
|||||||
us undefined. This is good, since we want to pull in any files
|
us undefined. This is good, since we want to pull in any files
|
||||||
which define it */
|
which define it */
|
||||||
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_INDIRECT;
|
cache_ptr->symbol.flags = BSF_DEBUGGING | BSF_INDIRECT;
|
||||||
|
|
||||||
|
/* @@ Stuffing pointers into integers is a no-no.
|
||||||
|
We can usually get away with it if the integer is
|
||||||
|
large enough though. */
|
||||||
|
if (sizeof (cache_ptr + 1) > sizeof (bfd_vma))
|
||||||
|
abort ();
|
||||||
|
|
||||||
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
cache_ptr->symbol.value = (bfd_vma) ((cache_ptr + 1));
|
||||||
cache_ptr->symbol.section = &bfd_ind_section;
|
cache_ptr->symbol.section = &bfd_ind_section;
|
||||||
*statep = 1;
|
*statep = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user