r54540 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54539‎ | r54540 | r54541 >
Date:22:08, 6 August 2009
Author:dale
Status:ok
Tags:
Comment:
* added check to chunk uploads to make sure we have not append beyond $wgMaxUploadSize size
Modified paths:
  • /trunk/phase3/includes/upload/UploadFromChunks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/upload/UploadFromChunks.php
@@ -216,6 +216,7 @@
217217
218218 // append the given chunk to the temporary uploaded file. (if no temporary uploaded file exists created it.
219219 function doChunkAppend(){
 220+ global $wgMaxUploadSize;
220221 // if we don't have a mTempAppendPath to generate a file from the chunk packaged var:
221222 if( !$this->mTempAppendPath ){
222223 // get temp name:
@@ -228,11 +229,17 @@
229230 }
230231 return $status;
231232 } else {
 233+ //check to make sure we have not expanded beyond $wgMaxUploadSize
 234+ if( ( filesize( $this->mTempAppendPath ) + filesize( $this->mTempPath ) ) > $wgMaxUploadSize )
 235+ $status = Status::newFatal( 'largefileserver' );
 236+
232237 if( is_file( $this->getRealPath( $this->mTempAppendPath ) ) ){
233238 $status = $this->appendToUploadFile( $this->mTempAppendPath, $this->mTempPath );
234239 } else {
235240 $status = Status::newFatal( 'filenotfound', $this->mTempAppendPath );
236241 }
 242+
 243+
237244 return $status;
238245 }
239246 }

Status & tagging log