Skip to content

Commit 6d6d83a

Browse files
rikkimaxthewilsonator
authored andcommitted
Swap assert to error message for mach-o section name length
1 parent eb972a4 commit 6d6d83a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

compiler/src/dmd/backend/machobj.d

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,8 +1893,18 @@ int MachObj_jmpTableSegment(Symbol* s)
18931893
int MachObj_getsegment(const(char)* sectname, const(char)* segname,
18941894
int p2align, int flags)
18951895
{
1896-
assert(strlen(sectname) <= 16);
1897-
assert(strlen(segname) <= 16);
1896+
if (strlen(sectname) > 16)
1897+
{
1898+
error(Srcpos.init, "invalid section name, length too long for `%s`", sectname);
1899+
return 0;
1900+
}
1901+
1902+
if (strlen(segname) > 16)
1903+
{
1904+
error(Srcpos.init, "invalid segment name, length too long for `%s`", segname);
1905+
return 0;
1906+
}
1907+
18981908
for (int seg = 1; seg < cast(int)SegData.length; seg++)
18991909
{ seg_data* pseg = SegData[seg];
19001910
if (I64)

0 commit comments

Comments
 (0)