Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created May 11, 2012 01:33
Show Gist options
  • Save ConradIrwin/2656940 to your computer and use it in GitHub Desktop.
Save ConradIrwin/2656940 to your computer and use it in GitHub Desktop.
#include <string.h>
#include "libxml/tree.h"
int main(){
char buf[4000000];
const char *line = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz&#xD;\n";
const char *xml = "<foo></foo>";
int i;
// 4MB of 80-byte lines with an entity at the end.
for (i = 0; i < 50000; i++) {
memcpy(&buf[i * 80], line, 80);
}
buf[4000000] = '\0';
xmlDocPtr doc = xmlReadMemory(xml, strlen(xml), NULL, NULL, 0);
xmlNodeSetContent(doc->children, buf);
xmlFreeDoc(doc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment