Issue 97 in teyjus: Segfault when linking

1 view
Skip to first unread message

tey...@googlecode.com

unread,
Mar 10, 2015, 11:15:30 AM3/10/15
to teyjus...@googlegroups.com
Status: New
Owner: ----

New issue 97 by giselle....@gmail.com: Segfault when linking
https://code.google.com/p/teyjus/issues/detail?id=97

What steps will reproduce the problem?

1. Create a module A that accumulates a module B.
2. Compile A with tjcc A
3. Link A with tjlink A (do not compile B)

What is the expected output?

Couldn't open file ././B.lpo for reading.
Error while reading top level module dummy
Error while reading top level module truncate
Linking aborted due to an exception.

(Indicating that B must be compiled before linking A).

What do you see instead?

Segmentation fault (core dumped)

What version of the product are you using? On what operating system?

Teyjus version 2.0-b2
Linux narnia 3.17.7-300.fc21.x86_64 #1 SMP Wed Dec 17 03:08:44 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux

Please provide any additional information below.

The problem is caused because TJPATH is not set, thus making getenv return
NULL. Running strdup on NULL causes the segfault. (See file
source/linker/file.c:50-53)

The attached patch fixes the problem. Can someone please review and let me
know if further changes are necessary?

Thank you!

Giselle.

Attachments:
fix_linker_segfault.patch 447 bytes

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
Reply all
Reply to author
Forward
0 new messages