Return-Path: X-Original-To: apmail-avro-dev-archive@www.apache.org Delivered-To: apmail-avro-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 39CF49E39 for ; Tue, 20 Dec 2011 02:47:53 +0000 (UTC) Received: (qmail 43721 invoked by uid 500); 20 Dec 2011 02:47:52 -0000 Delivered-To: apmail-avro-dev-archive@avro.apache.org Received: (qmail 43690 invoked by uid 500); 20 Dec 2011 02:47:52 -0000 Mailing-List: contact dev-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@avro.apache.org Delivered-To: mailing list dev@avro.apache.org Received: (qmail 43682 invoked by uid 99); 20 Dec 2011 02:47:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Dec 2011 02:47:52 +0000 X-ASF-Spam-Status: No, hits=-2002.5 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Dec 2011 02:47:51 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 9AE8011C914 for ; Tue, 20 Dec 2011 02:47:30 +0000 (UTC) Date: Tue, 20 Dec 2011 02:47:30 +0000 (UTC) From: "Douglas Creager (Updated) (JIRA)" To: dev@avro.apache.org Message-ID: <1117971657.29300.1324349250635.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1876488901.8307.1323818978315.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (AVRO-980) C: avro_schema_from_json ignores length parameter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AVRO-980?page=3Dcom.atlassian.= jira.plugin.system.issuetabpanels:all-tabpanel ] Douglas Creager updated AVRO-980: --------------------------------- Attachment: 0001-AVRO-980.-C-Handle-length-parameter-in-avro_schema_f.p= atch Here's a patch for this. Luckily we upgraded our internal copy of Jansson = to 2.1 awhile back =E2=80=94 it has a json_loadb function, which takes in a= length parameter. (Before, we used json_loads, which assumed a NUL-termin= ated string.) One thing we might need to consider is that this might break existing code,= if they were passing in incorrect (or dummy) values for the length paramet= er. =20 > C: avro_schema_from_json ignores length parameter=20 > -------------------------------------------------- > > Key: AVRO-980 > URL: https://issues.apache.org/jira/browse/AVRO-980 > Project: Avro > Issue Type: Bug > Components: c > Affects Versions: 1.6.1 > Environment: Linux x86_64 (Ubuntu 11.10) > Avro 1.6.1 > GCC 4.6.1 > cmake 2.8.5 > Reporter: Michael Cooper > Priority: Minor > Labels: c, schema > Attachments: 0001-AVRO-980.-C-Handle-length-parameter-in-avro_sch= ema_f.patch > > > The function avro_schema_from_json() takes in a const char* and a length = parameter, but it appears that the length parameter is ignored. > We have a project where the schema is a binary resource compiled into the= executable, and is not guaranteed to have a null terminator at the end. > This did not appear to be an issue because the function had a length para= meter. > The other day, It kept throwing errors about characters that were not in = the file at all. > Suspecting it was running off the end of the file, I had a look at the Av= ro-C code and found that even though the function takes in a length paramet= er, it does not use it and expects a null terminator. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs: https://issues.apache.org/jira/secure/ContactAdministrators!default.jsp= a For more information on JIRA, see: http://www.atlassian.com/software/jira