This is an automated email from the git hooks/post-receive script. smcv pushed a commit to branch debian/master in repository openjk.
commit 27bc43f16f6a99b09704f77f5870e9d3d9fe9fa1 Author: bibendovsky <[email protected]> Date: Sat Jul 23 18:26:16 2016 +0300 Check for chunk read error in EvaluateFields --- codeJK2/game/g_savegame.cpp | 7 +++++++ shared/qcommon/ojk_i_saved_game.h | 4 ++++ shared/qcommon/ojk_i_saved_game_fwd.h | 3 +++ shared/qcommon/ojk_saved_game.cpp | 5 +++++ shared/qcommon/ojk_saved_game.h | 4 ++++ 5 files changed, 23 insertions(+) diff --git a/codeJK2/game/g_savegame.cpp b/codeJK2/game/g_savegame.cpp index 5e75a1e9..e4c9ca9 100644 --- a/codeJK2/game/g_savegame.cpp +++ b/codeJK2/game/g_savegame.cpp @@ -647,6 +647,13 @@ static void EvaluateFields( pbData->sg_import( ::gi.saved_game); + if (!::gi.saved_game->is_all_data_read()) + { + ::G_Error( + ::va("EvaluateFields(): variable-sized chunk '%s' without handler!", + ::SG_GetChidText(ulChid))); + } + if (pFields) { for (auto pField = pFields; pField->psName; ++pField) { ::EvaluateField( diff --git a/shared/qcommon/ojk_i_saved_game.h b/shared/qcommon/ojk_i_saved_game.h index fc246f8..f050a78 100644 --- a/shared/qcommon/ojk_i_saved_game.h +++ b/shared/qcommon/ojk_i_saved_game.h @@ -44,6 +44,8 @@ bool ISavedGame::read_chunk( read<TSrc>( dst_value); + result &= is_all_data_read(); + return result; } @@ -60,6 +62,8 @@ bool ISavedGame::read_chunk( dst_values, dst_count); + result &= is_all_data_read(); + return result; } diff --git a/shared/qcommon/ojk_i_saved_game_fwd.h b/shared/qcommon/ojk_i_saved_game_fwd.h index 3573f3b..c9559fa 100644 --- a/shared/qcommon/ojk_i_saved_game_fwd.h +++ b/shared/qcommon/ojk_i_saved_game_fwd.h @@ -61,6 +61,9 @@ public: TDst* dst_values, int dst_count); + // Returns true if all data read from the internal buffer. + virtual bool is_all_data_read() const = 0; + // Writes a chunk into the file from the internal buffer. virtual bool write_chunk( diff --git a/shared/qcommon/ojk_saved_game.cpp b/shared/qcommon/ojk_saved_game.cpp index 936c80b..b170dfe 100644 --- a/shared/qcommon/ojk_saved_game.cpp +++ b/shared/qcommon/ojk_saved_game.cpp @@ -296,6 +296,11 @@ bool SavedGame::read_chunk( return true; } +bool SavedGame::is_all_data_read() const +{ + return io_buffer_.size() == io_buffer_offset_; +} + bool SavedGame::write_chunk( const SavedGame::ChunkId chunk_id) { diff --git a/shared/qcommon/ojk_saved_game.h b/shared/qcommon/ojk_saved_game.h index a91515c..e9b04d2 100644 --- a/shared/qcommon/ojk_saved_game.h +++ b/shared/qcommon/ojk_saved_game.h @@ -63,6 +63,10 @@ public: using ISavedGame::read_chunk; + // Returns true if all data read from the internal buffer. + bool is_all_data_read() const override; + + // Writes a chunk into the file from the internal buffer. bool write_chunk( const ChunkId chunk_id) override; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

