Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initialize return value on all exit paths.

E.g. __libc_start_main goes via "cpp_demangle_read_type" (which fails)
directly to the label "clean". On return rtn is uninitialized and gets
freed in __cxa_demangle itself.
  • Loading branch information...
commit 8aed23670bc125d8ae61bf8f2665240f58bdf7a3 1 parent 242e8e7
@TNorthover authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/libelftc_dem_gnu3.c
View
2  src/libelftc_dem_gnu3.c
@@ -453,7 +453,7 @@ __cxa_demangle_gnu3(const char *org)
struct cpp_demangle_data ddata;
ssize_t org_len;
unsigned int limit;
- char *rtn;
+ char *rtn = NULL;
if (org == NULL)
return (NULL);

5 comments on commit 8aed236

@cbergstrom

Has this been reviewed or pushed to "upstream" as well?

@TNorthover
Owner

Ah, no. From a quick glance this seemed to be the upstream. Could you tell me where I should submit it instead?

Sorry for the bad procedure.

@TNorthover
Owner

Oh I see, you mean libelftc. The code path being corrected only seems to have been introduced into the libcxxrt fork (revision 18482f1).

That said, I have just noticed a second rtn = NULL initialisation later on that's redundant with my patch. If this turns out to be the right forum, I'll update the request with that change too.

@davidchisnall

This looks good to me. I hit the same issue yesterday but hadn't had a time to debug it, so thanks for chasing it down. Chris: do you want to do the pull, or shall I?

@davidchisnall

Actually, looking at the libelftc code, they seem to have fixed a few bugs there too, so it's probably worth pulling in a new version and then reapplying the fixes.

Please sign in to comment.
Something went wrong with that request. Please try again.