Use malloced memory instead of stack-allocated, so that MALLOC_CHECK_=2

2006-05-03  Matthias Clasen  <mclasen@redhat.com>

	* tests/base64-test.c (test_incremental): Use malloced memory
	instead of stack-allocated, so that MALLOC_CHECK_=2 catches
	the OOB write...
This commit is contained in:
Matthias Clasen 2006-05-03 12:23:44 +00:00 committed by Matthias Clasen
parent a71284ce30
commit 9208517188
3 changed files with 30 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2006-05-03 Matthias Clasen <mclasen@redhat.com>
* tests/base64-test.c (test_incremental): Use malloced memory
instead of stack-allocated, so that MALLOC_CHECK_=2 catches
the OOB write...
* glib/gbookmarkfile.c (g_bookmark_file_load_from_data): Remove
an overzealous return_if_fail check that causes make check to
fail.
2006-05-02 Matthias Clasen <mclasen@redhat.com>
* configure.in: Bump version

View File

@ -1,3 +1,13 @@
2006-05-03 Matthias Clasen <mclasen@redhat.com>
* tests/base64-test.c (test_incremental): Use malloced memory
instead of stack-allocated, so that MALLOC_CHECK_=2 catches
the OOB write...
* glib/gbookmarkfile.c (g_bookmark_file_load_from_data): Remove
an overzealous return_if_fail check that causes make check to
fail.
2006-05-02 Matthias Clasen <mclasen@redhat.com>
* configure.in: Bump version

View File

@ -11,13 +11,16 @@ static guchar data[DATA_SIZE];
static void
test_incremental (gboolean line_break)
{
char text[DATA_SIZE * 2];
char *p;
guchar data2[DATA_SIZE];
int i;
gsize len, decoded_len, max;
int state, save;
guint decoder_save;
char *text;
guchar *data2;
data2 = g_malloc (DATA_SIZE);
text = g_malloc (DATA_SIZE * 2);
len = 0;
state = 0;
@ -65,6 +68,9 @@ test_incremental (gboolean line_break)
g_print ("Wrong decoded base64 data\n");
exit (1);
}
g_free (text);
g_free (data2);
}
static void
@ -90,6 +96,8 @@ test_full (void)
g_print ("Wrong decoded base64 data\n");
exit (1);
}
g_free (data2);
}
int