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

Access Violation when the network connection is lost and VSI_CACHE=true #4559

Closed
AndresPozo opened this issue Sep 28, 2021 · 2 comments
Closed
Assignees
Labels
Milestone

Comments

@AndresPozo
Copy link

Expected behavior and actual behavior.

The GeoTIFF driver produces an Access Violation when reading from a network drive and the connection is lost. This only happens when VSI_CACHE=TRUE. When VSI_CACHE=FALSE, the reading fails, but there is no Access Violation.

My hypothesis is that in cpl_vsi_cache.cpp there are many calls to "poBase->Seek" and "poBase->Read" that do not check if there is an error in the underlying calls.

Steps to reproduce the problem.

1 - Open a big enough GeoTIFF in a network share.
2 - Disconnect the network.
3 - Do several reads from random parts of the file.
4 - Access Violation

Operating system

Windows 10 Pro x64

GDAL version and provenance

GDAL 3.2.0 from https://www.gisinternals.com/

@rouault rouault self-assigned this Sep 28, 2021
@rouault rouault added the bug label Sep 28, 2021
@rouault rouault added this to the 3.3.3 milestone Sep 28, 2021
rouault added a commit that referenced this issue Sep 28, 2021
VSI cache: fix crash when a Read() to the underlying file fails (fixes #4559)
rouault added a commit that referenced this issue Sep 28, 2021
[Backport 3.3] VSI cache: fix crash when a Read() to the underlying file fails (fixes #4559)
@AndresPozo
Copy link
Author

Many thanks Rouault!!
I still have a doubt: In the VSICachedFile::LoadBlocks method, line 304 there is an unchecked poBase->Seek. Wouldn't it be necessary to check it as it is done in the call to poBase->Seek on line 343? I don't know the code well, so I don't know if the check is necessary.

@rouault
Copy link
Member

rouault commented Sep 29, 2021

I still have a doubt: In the VSICachedFile::LoadBlocks method, line 304 there is an unchecked poBase->Seek.

I've just added a check for consistency, but I believe I've never seen a Seek() failing (seeking beyond the extent of a file is a valid operation for example)

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

No branches or pull requests

2 participants