diff options
author | root <root@rshg047.dnsready.net> | 2011-04-27 22:24:53 +0000 |
---|---|---|
committer | root <root@rshg047.dnsready.net> | 2011-04-27 22:24:53 +0000 |
commit | 18d6577d511b9a1ac36eaae50060133a401e42a3 (patch) | |
tree | f681f9444a7a0a95916de40af82d3b805d5fb8d3 /community/yajl | |
parent | 69e1fada8bdc9588d0a3d8bc3403fa809d809a84 (diff) |
Wed Apr 27 22:24:53 UTC 2011
Diffstat (limited to 'community/yajl')
-rw-r--r-- | community/yajl/PKGBUILD | 34 | ||||
-rw-r--r-- | community/yajl/handle-null-case.patch | 78 |
2 files changed, 97 insertions, 15 deletions
diff --git a/community/yajl/PKGBUILD b/community/yajl/PKGBUILD index 71c3c1ee0..425947720 100644 --- a/community/yajl/PKGBUILD +++ b/community/yajl/PKGBUILD @@ -1,33 +1,37 @@ -# Maintainer: Daniel J Griffiths <ghost1227@archlinux.us> -# Maintainer: Thomas Dziedzic < gostrc at gmail > +# Maintainer: Dave Reisner <d@falconindy.com> +# Contributor: Daniel J Griffiths <ghost1227@archlinux.us> +# Contributor: Thomas Dziedzic < gostrc at gmail > # Contributor: Andrej Gelenberg <andrej.gelenberg@udo.edu> pkgname=yajl -pkgver=1.0.11 -pkgrel=3 +pkgver=2.0.0 +pkgrel=2 pkgdesc='Yet Another JSON Library.' arch=('i686' 'x86_64') url='http://lloyd.github.com/yajl/' -license=('BSD') +license=('ISC') makedepends=('cmake') -source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/lloyd/${pkgname}/tarball/${pkgver}") -md5sums=('5b60f4d59b3b1fb42d7808d08460fb12') +source=("$pkgname-$pkgver.tar.gz::https://github.com/lloyd/$pkgname/tarball/$pkgver" + "handle-null-case.patch") +md5sums=('ff3bb8531d1f3c48441a57220919c8e7' + 'dd6ad7386f6d19f1d68357d8a2d48f3e') build() { - cd lloyd-${pkgname}-f4baae0 + dirname=$(tar tf "$srcdir/$pkgname-$pkgver.tar.gz" | sed 1q); + cd "$dirname" - cmake \ - -DCMAKE_INSTALL_PREFIX=/usr \ - . + patch -Np1 < "$srcdir/handle-null-case.patch" + + cmake -DCMAKE_INSTALL_PREFIX=/usr . make } package() { - cd lloyd-${pkgname}-f4baae0 + dirname=$(tar tf "$srcdir/$pkgname-$pkgver.tar.gz" | sed 1q); + cd "$dirname" - make DESTDIR=${pkgdir} install + make DESTDIR="$pkgdir" install - install -D -m644 COPYING \ - ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE + install -Dm644 COPYING "$pkgdir/usr/share/licenses/${pkgname}/LICENSE" } diff --git a/community/yajl/handle-null-case.patch b/community/yajl/handle-null-case.patch new file mode 100644 index 000000000..923e23961 --- /dev/null +++ b/community/yajl/handle-null-case.patch @@ -0,0 +1,78 @@ +From 615924b7bf68791c166149a9f76bec740dacefd6 Mon Sep 17 00:00:00 2001 +From: Lloyd Hilaiel <lloyd@hilaiel.com> +Date: Tue, 26 Apr 2011 09:47:13 -0600 +Subject: [PATCH] crash fix, handle the case where yajl_alloc() is followed by + yajl_complete_parse() without a call to yajl_parse() in the + middle. closes #27. + +--- + src/yajl.c | 18 +++++++++++++++--- + src/yajl_parser.c | 2 +- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/src/yajl.c b/src/yajl.c +index 793eea3..293e545 100644 +--- a/src/yajl.c ++++ b/src/yajl.c +@@ -49,7 +49,7 @@ yajl_alloc(const yajl_callbacks * callbacks, + { + yajl_handle hand = NULL; + yajl_alloc_funcs afsBuffer; +- ++ + /* first order of business is to set up memory allocation routines */ + if (afs != NULL) { + if (afs->malloc == NULL || afs->realloc == NULL || afs->free == NULL) +@@ -73,7 +73,7 @@ yajl_alloc(const yajl_callbacks * callbacks, + hand->decodeBuf = yajl_buf_alloc(&(hand->alloc)); + hand->flags = 0; + yajl_bs_init(hand->stateStack, &(hand->alloc)); +- yajl_bs_push(hand->stateStack, yajl_state_start); ++ yajl_bs_push(hand->stateStack, yajl_state_start); + + return hand; + } +@@ -120,7 +120,7 @@ yajl_parse(yajl_handle hand, const unsigned char * jsonText, + { + yajl_status status; + +- // lazy allocate the lexer ++ /* lazy allocation of the lexer */ + if (hand->lexer == NULL) { + hand->lexer = yajl_lex_alloc(&(hand->alloc), + hand->flags & yajl_allow_comments, +@@ -135,6 +135,18 @@ yajl_parse(yajl_handle hand, const unsigned char * jsonText, + yajl_status + yajl_complete_parse(yajl_handle hand) + { ++ /* The lexer is lazy allocated in the first call to parse. if parse is ++ * never called, then no data was provided to parse at all. This is a ++ * "premature EOF" error unless yajl_allow_partial_values is specified. ++ * allocating the lexer now is the simplest possible way to handle this ++ * case while preserving all the other semantics of the parser ++ * (multiple values, partial values, etc). */ ++ if (hand->lexer == NULL) { ++ hand->lexer = yajl_lex_alloc(&(hand->alloc), ++ hand->flags & yajl_allow_comments, ++ !(hand->flags & yajl_dont_validate_strings)); ++ } ++ + return yajl_do_finish(hand); + } + +diff --git a/src/yajl_parser.c b/src/yajl_parser.c +index 20d73bf..3903b38 100644 +--- a/src/yajl_parser.c ++++ b/src/yajl_parser.c +@@ -155,7 +155,7 @@ yajl_status + yajl_do_finish(yajl_handle hand) + { + yajl_status stat; +- stat = yajl_do_parse(hand,(const unsigned char *)" ",1); ++ stat = yajl_do_parse(hand,(const unsigned char *) " ",1); + + if (stat != yajl_status_ok) return stat; + +-- +1.7.4.4 + |