[v2] ld/pdb: Avoid double-free on malformed symbol data
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_binutils_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_binutils_check--master-arm |
success
|
Test passed
|
Commit Message
When handle_debugs_section fails, create_module_info_substream frees
the file arrays for all modules, including the current one. Do not free
the current array in populate_module_stream as well.
ld/
* pdb.c (populate_module_stream): Leave mod_source->files cleanup to
the caller.
---
ld/pdb.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Comments
On 02.10.2026 19:45, Oleg Tolmatcev wrote:
> When handle_debugs_section fails, create_module_info_substream frees
> the file arrays for all modules, including the current one. Do not free
> the current array in populate_module_stream as well.
>
> ld/
> * pdb.c (populate_module_stream): Leave mod_source->files cleanup to
> the caller.
Okay.
@@ -3933,10 +3933,7 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size,
{
if (!handle_debugt_section (s, mod, types, ids, mod_num, strings,
&map, &num_types))
- {
- free (mod_source->files);
- return false;
- }
+ return false;
break;
}
@@ -3955,7 +3952,6 @@ populate_module_stream (bfd *stream, bfd *mod, uint32_t *sym_byte_size,
{
free (c13_info);
free (syms);
- free (mod_source->files);
free (map);
return false;
}