gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r30465 - in libmicrohttpd/src: include/plibc microhttpd


From: gnunet
Subject: [GNUnet-SVN] r30465 - in libmicrohttpd/src: include/plibc microhttpd
Date: Wed, 30 Oct 2013 01:53:38 +0100

Author: LRN
Date: 2013-10-30 01:53:38 +0100 (Wed, 30 Oct 2013)
New Revision: 30465

Modified:
   libmicrohttpd/src/include/plibc/plibc.h
   libmicrohttpd/src/microhttpd/test_postprocessor.c
Log:
  Add a variant of multipart preprocessor test that splits data in two parts
before feeding it to the preprocessor, trying all possible points where data
can be split. Prior to r30427 this test would have crashed only if data is
split at the very beginning (< 11). After r30427 this test crashes every time
the data is split somewhere around the boundary.
At least that is the case on W32.


Modified: libmicrohttpd/src/include/plibc/plibc.h
===================================================================
--- libmicrohttpd/src/include/plibc/plibc.h     2013-10-29 20:40:39 UTC (rev 
30464)
+++ libmicrohttpd/src/include/plibc/plibc.h     2013-10-30 00:53:38 UTC (rev 
30465)
@@ -71,7 +71,7 @@
 #define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
   (double)((x).LowPart))
 #ifndef __MINGW64_VERSION_MAJOR
-struct stat64
+struct _stati64
 {
     _dev_t st_dev;
     _ino_t st_ino;
@@ -81,9 +81,9 @@
     short st_gid;
     _dev_t st_rdev;
     __int64 st_size;
-    __time64_t st_atime;
-    __time64_t st_mtime;
-    __time64_t st_ctime;
+    time_t st_atime;
+    time_t st_mtime;
+    time_t st_ctime;
 };
 #endif
 typedef unsigned int sa_family_t;
@@ -558,7 +558,7 @@
 int _win_creat(const char *path, mode_t mode);
 char *_win_ctime(const time_t *clock);
 char *_win_ctime_r(const time_t *clock, char *buf);
-int _win_fstat(int handle, struct _stat *buffer);
+int _win_fstat(int handle, struct stat *buffer);
 int _win_ftruncate(int fildes, off_t length);
 int _win_truncate(const char *fname, int distance);
 int _win_kill(pid_t pid, int sig);
@@ -572,8 +572,8 @@
 void _win_srandom(unsigned int seed);
 int _win_remove(const char *path);
 int _win_rename(const char *oldname, const char *newname);
-int _win_stat(const char *path, struct _stat *buffer);
-int _win_stat64(const char *path, struct stat64 *buffer);
+int _win_stat(const char *path, struct stat *buffer);
+int _win_stati64(const char *path, struct _stati64 *buffer);
 long _win_sysconf(int name);
 int _win_unlink(const char *filename);
 int _win_write(int fildes, const void *buf, size_t nbyte);
@@ -585,8 +585,8 @@
                 unsigned long long offset);
 int _win_msync(void *start, size_t length, int flags);
 int _win_munmap(void *start, size_t length);
-int _win_lstat(const char *path, struct _stat *buf);
-int _win_lstat64(const char *path, struct stat64 *buf);
+int _win_lstat(const char *path, struct stat *buf);
+int _win_lstati64(const char *path, struct _stati64 *buf);
 int _win_readlink(const char *path, char *buf, size_t bufsize);
 int _win_accept(int s, struct sockaddr *addr, int *addrlen);
 
@@ -745,6 +745,7 @@
  #define TDESTROY(r, f) tdestroy(r, f)
  #define LFIND(k, b, n, s, c) lfind(k, b, n, s, c)
  #define LSEARCH(k, b, n, s, c) lsearch(k, b, n, s, c)
+ #define STRUCT_STAT64 struct stat64
 #else
  #define DIR_SEPARATOR '\\'
  #define DIR_SEPARATOR_STR "\\"
@@ -780,7 +781,7 @@
  #define REMOVE(p) _win_remove(p)
  #define RENAME(o, n) _win_rename(o, n)
  #define STAT(p, b) _win_stat(p, b)
- #define STAT64(p, b) _win_stat64(p, b)
+ #define STAT64(p, b) _win_stati64(p, b)
  #define SYSCONF(n) _win_sysconf(n)
  #define UNLINK(f) _win_unlink(f)
  #define WRITE(f, b, n) _win_write(f, b, n)
@@ -795,7 +796,7 @@
  #define STRERROR(i) _win_strerror(i)
  #define READLINK(p, b, s) _win_readlink(p, b, s)
  #define LSTAT(p, b) _win_lstat(p, b)
- #define LSTAT64(p, b) _win_lstat64(p, b)
+ #define LSTAT64(p, b) _win_lstati64(p, b)
  #define PRINTF printf
  #define FPRINTF fprintf
  #define VPRINTF(f, a) vprintf(f, a)
@@ -845,6 +846,7 @@
  #define TDESTROY(r, f) _win_tdestroy(r, f)
  #define LFIND(k, b, n, s, c) _win_lfind(k, b, n, s, c)
  #define LSEARCH(k, b, n, s, c) _win_lsearch(k, b, n, s, c)
+ #define STRUCT_STAT64 struct _stati64
 #endif
 
 /* search.h */

Modified: libmicrohttpd/src/microhttpd/test_postprocessor.c
===================================================================
--- libmicrohttpd/src/microhttpd/test_postprocessor.c   2013-10-29 20:40:39 UTC 
(rev 30464)
+++ libmicrohttpd/src/microhttpd/test_postprocessor.c   2013-10-30 00:53:38 UTC 
(rev 30465)
@@ -151,6 +151,46 @@
 
 
 static int
+test_multipart_splits ()
+{
+  struct MHD_Connection connection;
+  struct MHD_HTTP_Header header;
+  struct MHD_PostProcessor *pp;
+  unsigned int want_off;
+  int i;
+  int delta;
+  size_t size;
+  size_t splitpoint;
+
+  size = strlen (FORM_DATA);
+  for (splitpoint = 1; splitpoint < size; splitpoint++)
+  {
+    want_off = FORM_START;
+    memset (&connection, 0, sizeof (struct MHD_Connection));
+    memset (&header, 0, sizeof (struct MHD_HTTP_Header));
+    connection.headers_received = &header;
+    header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
+    header.value =
+      MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA ", boundary=AaB03x";
+    header.kind = MHD_HEADER_KIND;
+    pp = MHD_create_post_processor (&connection,
+                                    1024, &value_checker, &want_off);
+    i = 0;
+    delta = splitpoint;
+    MHD_post_process (pp, &FORM_DATA[i], delta);
+    i += delta;
+    delta = 1 + size - i;
+    MHD_post_process (pp, &FORM_DATA[i], delta);
+    i += delta;
+    MHD_destroy_post_processor (pp);
+    if (want_off != FORM_END)
+      return (int) splitpoint;
+  }
+  return 0;
+}
+
+
+static int
 test_multipart ()
 {
   struct MHD_Connection connection;
@@ -262,6 +302,7 @@
   unsigned int errorCount = 0;
 
   errorCount += test_urlencoding ();
+  errorCount += test_multipart_splits ();
   errorCount += test_multipart ();
   errorCount += test_nested_multipart ();
   errorCount += test_empty_value ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]