From patchwork Wed Jun 1 17:14:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 98312 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 28274B6F84 for ; Thu, 2 Jun 2011 11:15:08 +1000 (EST) Received: from localhost ([::1]:46435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRwV7-0006sW-2F for incoming@patchwork.ozlabs.org; Wed, 01 Jun 2011 21:15:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]:41103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRwQ2-0006Kq-9B for qemu-devel@nongnu.org; Wed, 01 Jun 2011 21:09:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRwQ1-0005qW-1s for qemu-devel@nongnu.org; Wed, 01 Jun 2011 21:09:50 -0400 Received: from mout.perfora.net ([74.208.4.194]:52171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRp3E-0007tq-32 for qemu-devel@nongnu.org; Wed, 01 Jun 2011 13:17:48 -0400 Received: from localhost.localdomain ([32.97.110.59]) by mrelay.perfora.net (node=mrus4) with ESMTP (Nemesis) id 0LtqTF-1PRQv90LdV-011DeG; Wed, 01 Jun 2011 13:17:45 -0400 From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 1 Jun 2011 12:14:54 -0500 Message-Id: <1306948500-15086-9-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1306948500-15086-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1306948500-15086-1-git-send-email-mdroth@linux.vnet.ibm.com> X-Provags-ID: V02:K0:AI5YuiW5nLEKYK0Mio+fofSUlIgV1cakBAuo7hS0OwP iePbCvydGN2N4UT8FEuvScQhE5s42KzkZ6cptfyk4BhdHD6lJ6 QiIB0aNvEbCf4Vyt7kRUsz5fl15lrPjWJNssNuy/ewXD5yOPTO KvsQjBfoomuq3e3zEQIXmHAj/odtUVkhvnX3DeV7BAw/PW/Qvh HYj1T5bkAssp8JrUNfU165/K5DdzuRQ5mvRw+AiKQs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.208.4.194 Cc: aliguori@linux.vnet.ibm.com, Jes.Sorensen@redhat.com, agl@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v1][ 08/14] json-streamer: make sure to reset token_size after emitting a token list X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony Liguori Signed-off-by: Michael Roth --- json-streamer.c | 2 ++ json-streamer.h | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) diff --git a/json-streamer.c b/json-streamer.c index 6b9af63..a6cb28f 100644 --- a/json-streamer.c +++ b/json-streamer.c @@ -65,6 +65,7 @@ static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTok parser->emit(parser, parser->tokens); QDECREF(parser->tokens); parser->tokens = qlist_new(); + parser->token_size = 0; } else if (parser->token_size > MAX_TOKEN_SIZE || parser->bracket_count > MAX_NESTING || parser->brace_count > MAX_NESTING) { @@ -76,6 +77,7 @@ static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTok parser->emit(parser, parser->tokens); QDECREF(parser->tokens); parser->tokens = qlist_new(); + parser->token_size = 0; } } diff --git a/json-streamer.h b/json-streamer.h index 09f3bd7..f09bc4d 100644 --- a/json-streamer.h +++ b/json-streamer.h @@ -24,6 +24,7 @@ typedef struct JSONMessageParser int brace_count; int bracket_count; QList *tokens; + uint64_t token_size; } JSONMessageParser; void json_message_parser_init(JSONMessageParser *parser,