Chromium Code Reviews| Index: src/parser.h |
| diff --git a/src/parser.h b/src/parser.h |
| index cf7d2a5905b1e3f12d472b4e9033275c394ac142..cb13f716e985a0b9200f21bd1cd49b39a601c0a6 100644 |
| --- a/src/parser.h |
| +++ b/src/parser.h |
| @@ -114,6 +114,13 @@ class ScriptDataImpl : public ScriptData { |
| ? store_[PreparseDataConstants::kSymbolCountOffset] |
| : 0; |
| } |
| + int function_count() { |
| + int functions_size = |
| + static_cast<int>(store_[PreparseDataConstants::kFunctionsSizeOffset]); |
| + if (functions_size < 0) return 0; |
|
ulan
2014/04/04 12:10:59
Shouldn't these checks be ASSERTs instead?
What do
marja
2014/04/04 12:13:18
It's just invalid data then. The length field is t
|
| + if (functions_size % FunctionEntry::kSize != 0) return 0; |
| + return functions_size / FunctionEntry::kSize; |
| + } |
| // The following functions should only be called if SanityCheck has |
| // returned true. |
| bool has_error() { return store_[PreparseDataConstants::kHasErrorOffset]; } |