Skip to content
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

FileWatcher.cpp: continue monitoring a watched dir for changes even if a buffer overflow nullified one notification #3846

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

TwoEpsilon
Copy link
Contributor

In the function ReadDirectoryChangesNotification the parameter bytesTransfered may be zero, presumably indicating an overflow: the buffer was too small to contain all the change notifications that have accumulated, in which case these notifications are discarded. But we should keep on monitoring the watched dir for future changes as we would do when handling a normal notification. The original code didn't do that, and this is what I've fixed.

This change solves the problem of Sumatra not reloading PDF files in situations where other files in the same directory are being repeatedly changed very frequently, which creates a race condition that may lead to a buffer overflow. If needed I can provide more details on the circumstances under which I came across this problem.

Thanks!

…es to continue monitoring the watched dir even if bytesTransfered = 0, which probably means an overflow.
@kjk kjk merged commit 81cd22e into sumatrapdfreader:master Nov 3, 2023
1 check passed
@kjk
Copy link
Member

kjk commented Nov 3, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants