Author: clebert.suconic(a)jboss.com
Date: 2010-07-21 19:13:23 -0400 (Wed, 21 Jul 2010)
New Revision: 9450
Modified:
trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
Log:
https://jira.jboss.org/browse/HORNETQ-440 - fix on isValidSize during read
Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2010-07-21 20:39:57 UTC
(rev 9449)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2010-07-21 23:13:23 UTC
(rev 9450)
@@ -490,21 +490,27 @@
variableSize = wholeFileBuffer.getInt();
+ if (recordType != JournalImpl.DELETE_RECORD_TX)
+ {
+ if (JournalImpl.isInvalidSize(journalFileSize,
wholeFileBuffer.position(), 1))
+ {
+ wholeFileBuffer.position(pos +1);
+ continue;
+ }
+
+ userRecordType = wholeFileBuffer.get();
+ }
+
if (JournalImpl.isInvalidSize(journalFileSize, wholeFileBuffer.position(),
variableSize))
{
wholeFileBuffer.position(pos + 1);
continue;
}
- if (recordType != JournalImpl.DELETE_RECORD_TX)
- {
- userRecordType = wholeFileBuffer.get();
- }
-
record = new byte[variableSize];
- wholeFileBuffer.get(record);
- }
+ wholeFileBuffer.get(record);
+ }
// Case this is a transaction, this will contain the number of
pendingTransactions on a transaction, at the
// currentFile
@@ -3416,6 +3422,7 @@
else
{
final int position = bufferPos + size;
+
return position > fileSize || position < 0;
}