2004-08-03 Martin Baulig <martin@ximian.com>
authorMartin Baulig <martin@novell.com>
Tue, 3 Aug 2004 05:02:37 +0000 (05:02 -0000)
committerMartin Baulig <martin@novell.com>
Tue, 3 Aug 2004 05:02:37 +0000 (05:02 -0000)
* debug-mono-symfile.c (read_string): Correctly read the string.

svn path=/trunk/mono/; revision=31779

mono/metadata/ChangeLog
mono/metadata/debug-mono-symfile.c

index 5d95c082ce95182b69d5aea46f9a389239aa056a..db0f01e5cb7d17d41543c2609207cbfbc8e1917e 100644 (file)
@@ -1,3 +1,7 @@
+2004-08-03  Martin Baulig  <martin@ximian.com>
+
+       * debug-mono-symfile.c (read_string): Correctly read the string.
+
 2004-07-30  Zoltan Varga  <vargaz@freemail.hu>
 
        * marshal.c (signature_dup_add_this): Fix bug in previous patch.
index 183cee2eb8b5d445ba82cf1a3e0a2c7b789eadb5..6beea2fe2098c4d66a83f89d664bd5ce0690f521 100644 (file)
@@ -126,11 +126,30 @@ mono_debug_close_mono_symbol_file (MonoSymbolFile *symfile)
        g_free (symfile);
 }
 
+static int
+read_leb128 (const char *ptr, const char **rptr)
+{
+       int ret = 0;
+       int shift = 0;
+       char b;
+
+       do {
+               b = *ptr++;
+                               
+               ret = ret | ((b & 0x7f) << shift);
+               shift += 7;
+       } while ((b & 0x80) == 0x80);
+
+       if (rptr)
+               *rptr = ptr;
+
+       return ret;
+}
+
 static gchar *
 read_string (const char *ptr)
 {
-       int len = read32 (ptr);
-       ptr += sizeof(guint32);
+       int len = read_leb128 (ptr, &ptr);
        return g_filename_from_utf8 (ptr, len, NULL, NULL, NULL);
 }