A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
be sure that we don't try to read bytes after the end of the file
[simgrid.git]
/
src
/
surf
/
storage_n11.cpp
diff --git
a/src/surf/storage_n11.cpp
b/src/surf/storage_n11.cpp
index
8fc1ede
..
42fef37
100644
(file)
--- a/
src/surf/storage_n11.cpp
+++ b/
src/surf/storage_n11.cpp
@@
-433,7
+433,11
@@
StorageAction *StorageN11::close(surf_file_t fd)
StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
{
if(fd->current_position + size > fd->size){
StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
{
if(fd->current_position + size > fd->size){
- size = fd->size - fd->current_position;
+ if (fd->current_position > fd->size){
+ size = 0;
+ } else {
+ size = fd->size - fd->current_position;
+ }
fd->current_position = fd->size;
}
else
fd->current_position = fd->size;
}
else