Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lambdageek/1e5f8904daa2493093b825b32144d472 to your computer and use it in GitHub Desktop.
Save lambdageek/1e5f8904daa2493093b825b32144d472 to your computer and use it in GitHub Desktop.
From dbb849d0228276062fff1acf3a2d49b7ff065b5d Mon Sep 17 00:00:00 2001
From: Aleksey Kliger <[email protected]>
Date: Wed, 3 Jan 2018 17:38:07 -0500
Subject: [PATCH] Print some info if we are asked to look up a method token
that's outside the range of the PPDB.
---
mono/metadata/debug-mono-ppdb.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/mono/metadata/debug-mono-ppdb.c b/mono/metadata/debug-mono-ppdb.c
index 4d61efe345a..8198ef523b8 100644
--- a/mono/metadata/debug-mono-ppdb.c
+++ b/mono/metadata/debug-mono-ppdb.c
@@ -414,7 +414,15 @@ mono_ppdb_get_seq_points (MonoDebugMethodInfo *minfo, char **source_file, GPtrAr
method_idx = mono_metadata_token_index (method->token);
- mono_metadata_decode_row (&tables [MONO_TABLE_METHODBODY], method_idx-1, cols, MONO_METHODBODY_SIZE);
+ MonoTableInfo *methodbody_table = &tables [MONO_TABLE_METHODBODY];
+ if (G_UNLIKELY (method_idx - 1 >= methodbody_table->rows)) {
+ char *method_name = mono_method_full_name (method, FALSE);
+ g_warning ("Method idx %d is greater than number of rows (%d) in PPDB MethodDebugInformation table, for method %s",
+ method_idx - 1, methodbody_table->rows, method_name);
+ g_free (method_name);
+ return;
+ }
+ mono_metadata_decode_row (methodbody_table, method_idx-1, cols, MONO_METHODBODY_SIZE);
docidx = cols [MONO_METHODBODY_DOCUMENT];
--
2.15.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment