-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
airscan.c: don't call sane_exit() within sane_init(), return status #61
Conversation
Hi Zdenek, this is not safe, because at this case nobody will cleanup after partial init. I instead renamed Please confirm that it fixes the initial issue. |
The crash moved a little further:
|
Oops! My fault! Fixed, please, test again. |
Np, I'll check it the fix. |
@alexpevzner unfortunately, it is no use unless you initialize the |
Heh, github automatically closes the merge request if the patched code is removed from branch... I'll do a separate pull request. |
It needs to be better investigated. C zero-fills all uninitialized static variables, and if explicit initialization changes behaviour, something really weird happens (for example, explicit initialization may move variable to another address, from .bss to .data section, and if there is memory corruption error, it may affect another set of variables). Unfortunately, I can't reproduce. |
You can reproduce by gdb. Run Steps:
|
I'll check what it is really in |
Hmm... now I'm unable to reproduce too. I'll check perl-Image-Sane test suite in copr just for sure. |
The build succeeded... I had probably old package in chroot or built without the patch... sorry for the noise, ending of week... |
@alexpevzner Either way, thanks for the fix! |
Nice to have this problem resolved. Thank a lot for your help! |
Hi Alex,
there is an issue in Fedora -
perl-Image-Sane
, which depends on all SANE backends, fails to build after addingsane-airscan
project into Fedora - to be precise, its test suite started to fail.Petr Pisar,
perl-Image-Sane
maintainer, was able to isolate the issue to simplescanimage
call within mock.I looked into the issue and found out airscan backend calls
sane_exit()
withinsane_init()
ifstatus
isn't good.sane_exit()
is not linked tosane_exit()
withinairscan
backend, butsane_exit()
fromsane-backends-libs
is called instead.Calling sane-backends
sane_exit()
causes to clean up all other opened backends underscanimage
hands, resulting into segmentation fault.I took the solution from
pixma
backend - it seems the backend doesn't callsane_exit()
in case of error, but only returns the current status to function above, which should be capable to clean up (callssane_exit()
on all backends).With the fix, segfault is gone and
perl-Image-Sane
test suite passes.Is the patch okay? Please let me know if I should change something.
If it is okay, would you mind merging it?
Thank you in advance,
Zdenek