Skip to content
This repository has been archived by the owner on Dec 29, 2020. It is now read-only.

Occasional seg fault after write_fw1_cursorfile returns -1 #48

Open
jvm3487 opened this issue Aug 1, 2018 · 0 comments
Open

Occasional seg fault after write_fw1_cursorfile returns -1 #48

jvm3487 opened this issue Aug 1, 2018 · 0 comments

Comments

@jvm3487
Copy link
Contributor

jvm3487 commented Aug 1, 2018

This seg fault seems to be less common than the one seen in #47.

Occasionally (every 25 runs or so), write_fw1_cursorfile will return -1. This also usually (but not always) results in a crash complaining of memory corruption or double free with something like the following backtrace from turning on DEBUG:

free()
stringlist_delete()
exit_loggrabber()
submit_screen()

where in this case, the write_fw1_cursorfile in submit_screen() is returning the -1.

I added additional logic to write_fw1_cursorfile just to see what errno was being returned by fprintf, and it is EBADF (Bad file descriptor). I am not sure if this indicates an early close somehow or some type of overwrite of static memory. If I compile a version without #37, I never experience the crash, but it is not clear to me whether that change is to blame or it is affected by some type of latent bug.

The only error messages seen are:
ERROR: Error when updating cursor.
ERROR: -1 characters written instead of 33.

A normal run through valgrind showed one explicit memory error that the string being passed to atoi in write_fw1_cursorfile is only NULL terminated due to undefined behavior (the position char string seems to rely on the underlying memory to be 0's which is not a guarantee even though it is likely). However, initializing this array fixed the memory error but did not seem to solve the problem unfortunately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant