[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-234-g1eb1068 |
Date: |
Thu, 10 Mar 2011 14:18:11 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via 1eb1068b6671ecdd256bf0070ee18f9e07e7d289 (commit)
via 973663eb4cddb830c9023f4507c28fce03fc8726 (commit)
from 84dd2a6e8461d8b1ef6d5ed9b78a547da4efa0d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=1eb1068b6671ecdd256bf0070ee18f9e07e7d289
commit 1eb1068b6671ecdd256bf0070ee18f9e07e7d289
Merge: 973663e 84dd2a6
Author: Bastiaan Jacques <address@hidden>
Date: Thu Mar 10 15:17:59 2011 +0100
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/gnash
http://git.savannah.gnu.org/cgit//commit/?id=973663eb4cddb830c9023f4507c28fce03fc8726
commit 973663eb4cddb830c9023f4507c28fce03fc8726
Author: Bastiaan Jacques <address@hidden>
Date: Thu Mar 10 15:13:13 2011 +0100
Avoid integer overflow while checking file sizes for seeks. Add a test for
32-bit machines. Should fix bug #32732.
diff --git a/libbase/tu_file.cpp b/libbase/tu_file.cpp
index 17159d0..b9aa13b 100644
--- a/libbase/tu_file.cpp
+++ b/libbase/tu_file.cpp
@@ -171,14 +171,14 @@ bool
tu_file::seek(std::streampos pos)
{
// TODO: optimize this by caching total stream size ?
- if (static_cast<size_t>(pos) > size()) return false;
+ if (pos > static_cast<std::streampos>(size())) return false;
std::clearerr(_data); // make sure EOF flag is cleared.
const int result = std::fseek(_data, pos, SEEK_SET);
if (result == EOF) {
return false;
}
-
+ assert (pos < std::numeric_limits<long>::max());
assert (std::ftell(_data) == pos);
return true;
diff --git a/testsuite/libbase.all/NoSeekFileTest.cpp
b/testsuite/libbase.all/NoSeekFileTest.cpp
index bca1476..7762d69 100644
--- a/testsuite/libbase.all/NoSeekFileTest.cpp
+++ b/testsuite/libbase.all/NoSeekFileTest.cpp
@@ -41,6 +41,7 @@
#include <fcntl.h>
#include <string.h>
#include <sstream>
+#include <limits>
using namespace std;
@@ -153,6 +154,20 @@ main(int /*argc*/, char** /*argv*/)
lseek(raw, 0, SEEK_SET);
compare_reads(orig.get(), raw, "cache", "raw");
+
+ if (sizeof(size_t) != sizeof(std::streamoff)) {
+ std::streampos pos = std::numeric_limits<size_t>::max();
+ pos += orig->size() / 2;
+ // Check that seek() handles integer overflow situations gracefully.
+ if (orig->seek(pos)) {
+ runtest.fail("Successfully sought to an invalid position.");
+ } else {
+ runtest.pass("Gracefully handled invalid seek.");
+ }
+ }
+
+
+
return 0;
}
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_start-234-g1eb1068,
Bastiaan Jacques <=