Skip to content

Commit efbdfb0

Browse files
authored
Merge pull request #390 from sxci/fix-crc32-check
fix block's crc32 checker
2 parents 113e1a9 + 970c613 commit efbdfb0

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/main/java/com/qiniu/storage/ResumeUploader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ private Response upload0() throws QiniuException {
150150
}
151151

152152
ResumeBlockInfo blockInfo = response.jsonToObject(ResumeBlockInfo.class);
153+
if (blockInfo.crc32 != crc) {
154+
throw new QiniuException(new Exception("block's crc32 is not match"));
155+
}
153156
contexts[contextIndex++] = blockInfo.ctx;
154157
uploaded += blockSize;
155158
helper.record(uploaded);

src/main/java/com/qiniu/storage/StreamUploader.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ private Response upload0() throws QiniuException {
134134
}
135135
}
136136
ResumeBlockInfo blockInfo = response.jsonToObject(ResumeBlockInfo.class);
137+
if (blockInfo.crc32 != crc) {
138+
throw new QiniuException(new Exception("block's crc32 is not match"));
139+
}
137140
contexts.add(blockInfo.ctx);
138141
uploaded += bufferIndex;
139142
}

0 commit comments

Comments
 (0)