Index: trunk/extensions/CodeReview/CodeRepository.php |
— | — | @@ -132,6 +132,9 @@ |
133 | 133 | * Load a particular revision out of the DB |
134 | 134 | */ |
135 | 135 | function getRevision( $id ) { |
| 136 | + if ( !$this->isValidRev( $id ) ) { |
| 137 | + return null; |
| 138 | + } |
136 | 139 | $dbr = wfGetDB( DB_SLAVE ); |
137 | 140 | $row = $dbr->selectRow( |
138 | 141 | 'code_rev', |
— | — | @@ -178,4 +181,17 @@ |
179 | 182 | |
180 | 183 | return $data; |
181 | 184 | } |
| 185 | + |
| 186 | + /** |
| 187 | + * Is the requested revid a valid revision to show? |
| 188 | + * @return bool |
| 189 | + * @param $rev int Rev id to check |
| 190 | + */ |
| 191 | + function isValidRev( $rev ) { |
| 192 | + $rev = intval( $rev ); |
| 193 | + if ( $rev > 0 && $rev <= $this->getLastStoredRev() ) { |
| 194 | + return true; |
| 195 | + } |
| 196 | + return false; |
| 197 | + } |
182 | 198 | } |