I'm getting a series of Invalid read of size 1 errors. These seem to be
related to strlen() calls. How is it possible for strlen() to make an
invalid read?

Here is my valgrind output:

==21737== Invalid read of size 1
==21737==    at 0x483EF46: strlen (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10D7E6: crawler_init (crawler.c:1165)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c0 is 0 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==
==21737== Invalid read of size 1
==21737==    at 0x483EF54: strlen (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10D7E6: crawler_init (crawler.c:1165)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c1 is 1 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==
==21737== Invalid read of size 1
==21737==    at 0x483EF46: strlen (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10D89B: crawler_init (crawler.c:1166)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c0 is 0 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==
==21737== Invalid read of size 1
==21737==    at 0x483EF54: strlen (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10D89B: crawler_init (crawler.c:1166)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c1 is 1 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==
==21737== Invalid read of size 1
==21737==    at 0x4993BFD: ??? (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49D0D82: ??? (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49759AF: mysql_real_escape_string_quote (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49759DB: mysql_real_escape_string (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x10D8BB: crawler_init (crawler.c:1166)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c0 is 0 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==
==21737== Invalid read of size 1
==21737==    at 0x499D751: ??? (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49D0D98: ??? (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49759AF: mysql_real_escape_string_quote (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49759DB: mysql_real_escape_string (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x10D8BB: crawler_init (crawler.c:1166)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c0 is 0 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==
==21737== Invalid read of size 1
==21737==    at 0x49D0DCB: ??? (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49759AF: mysql_real_escape_string_quote (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x49759DB: mysql_real_escape_string (in
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.21.1.20)
==21737==    by 0x10D8BB: crawler_init (crawler.c:1166)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Address 0x7adf2c0 is 0 bytes inside a block of size 52 free'd
==21737==    at 0x483CA3F: free (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x10CC43: new_head_conn (crawler.c:911)
==21737==    by 0x10D751: crawler_init (crawler.c:1148)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==  Block was alloc'd at
==21737==    at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==21737==    by 0x50DD50E: strdup (strdup.c:42)
==21737==    by 0x10D70C: crawler_init (crawler.c:1145)
==21737==    by 0x10E417: main (crawler.c:1383)
==21737==

Source code for my app is available at
https://github.com/JamesRead5737/webcrawler

Thanks,
James Read
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to