Fixed #54
authoradam <adamansky@gmail.com>
Fri, 22 Mar 2013 11:05:12 +0000 (18:05 +0700)
committeradam <adamansky@gmail.com>
Fri, 22 Mar 2013 11:05:12 +0000 (18:05 +0700)
.gitignore
Changelog
luaejdb/luaejdb.iml
package.json
tcejdb/bson.c
tcejdb/configure
tcejdb/configure.ac
tcejdb/debian/changelog
tcejdb/testejdb/t2.c

index 75f8433..293223b 100644 (file)
@@ -52,6 +52,7 @@ config.status
 /tcejdb/testejdb/t1
 /tcejdb/testejdb/t2
 /tcejdb/testejdb/t3
+/tcejdb/testejdb/t4
 
 */nbproject/private/*
 
index fcc9743..2925fe5 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+2013-03-22 Anton Adamansky. <adamansky@gmail.com>
+    * Fixed number index crash #54
+    - Release 1.0.67
+
 2013-03-20 Anton Adamansky. <adamansky@gmail.com>
     * Python3 binding
     * Lua binding
index 24790d5..a914152 100644 (file)
@@ -2,7 +2,6 @@
 <module type="LUA_MODULE" version="4">
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />
-    <content url="file://$USER_HOME$/Downloads/tokyocabinet-lua-1.10" />
     <content url="file://$MODULE_DIR$" />
     <orderEntry type="jdk" jdkName="Kahlua" jdkType="Lua SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
index 58c5f74..3bd4b3b 100644 (file)
@@ -1,6 +1,6 @@
 {
     "name" : "ejdb",
-    "version" : "1.0.64",
+    "version" : "1.0.67",
     "main" : "node/ejdb.js",
     "homepage" : "http://ejdb.org",
     "description" : "EJDB - Embedded JSON Database engine",
index 6feafe6..1bffd76 100644 (file)
@@ -1277,7 +1277,7 @@ EJDB_EXPORT void bson_numstr(char *str, int64_t i) {
 }
 
 EJDB_EXPORT int bson_numstrn(char *str, int maxbuf, int64_t i) {
-    if (i < 1000 && maxbuf > 4) {
+    if (i >= 0 && i < 1000 && maxbuf > 4) {
         memcpy(str, bson_numstrs[i], 4);
         return strlen(bson_numstrs[i]);
     } else {
index 1c652e5..1f02042 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tcejdb 1.0.66.
+# Generated by GNU Autoconf 2.69 for tcejdb 1.0.67.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='tcejdb'
 PACKAGE_TARNAME='tcejdb'
-PACKAGE_VERSION='1.0.66'
-PACKAGE_STRING='tcejdb 1.0.66'
+PACKAGE_VERSION='1.0.67'
+PACKAGE_STRING='tcejdb 1.0.67'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures tcejdb 1.0.66 to adapt to many kinds of systems.
+\`configure' configures tcejdb 1.0.67 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1319,7 +1319,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of tcejdb 1.0.66:";;
+     short | recursive ) echo "Configuration of tcejdb 1.0.67:";;
    esac
   cat <<\_ACEOF
 
@@ -1426,7 +1426,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-tcejdb configure 1.0.66
+tcejdb configure 1.0.67
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1724,7 +1724,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by tcejdb $as_me 1.0.66, which was
+It was created by tcejdb $as_me 1.0.67, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -4893,7 +4893,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by tcejdb $as_me 1.0.66, which was
+This file was extended by tcejdb $as_me 1.0.67, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -4946,7 +4946,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-tcejdb config.status 1.0.66
+tcejdb config.status 1.0.67
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index 29a270e..226fcc1 100644 (file)
@@ -11,7 +11,7 @@ test -n "$CPPFLAGS" && MYCPPFLAGS="$CPPFLAGS $MYCPPFLAGS"
 test -n "$LDFLAGS" && MYLDFLAGS="$LDFLAGS $MYLDFLAGS"
 
 # Package name
-AC_INIT(tcejdb, 1.0.66)
+AC_INIT(tcejdb, 1.0.67)
 
 # Package information
 MYLIBVER=9
index 42bef72..6b2d97a 100644 (file)
@@ -1,3 +1,9 @@
+libtcejdb (1.0.67) unstable; urgency=low
+
+  * Fixed number index crash #54
+
+ -- Anton Adamansky <adamansky@gmail.com>  Fri, 22 Mar 2013 18:01:39 +0700
+
 libtcejdb (1.0.66) stable; urgency=low
 
   * Better BSON error reporting
index 6d3ebbf..3630b18 100644 (file)
@@ -13,6 +13,7 @@
 #include "CUnit/Basic.h"
 #include <assert.h>
 #include "ejdb_private.h"
+#include "debian/libtcejdb9-dev/usr/include/tcejdb/bson.h"
 #include <locale.h>
 
 /*
@@ -4222,6 +4223,19 @@ void testTicket43() {
     tcxstrdel(log);
 }
 
+void testTicket54() {
+    EJCOLL *coll = ejdbcreatecoll(jb, "ticket54", NULL);
+    CU_ASSERT_PTR_NOT_NULL_FATAL(coll);
+    bson b;
+    bson_oid_t oid;
+    bson_init(&b);
+    bson_append_long(&b, "value", -10000000L);
+    bson_finish(&b);
+    CU_ASSERT_TRUE(ejdbsavebson(coll, &b, &oid));
+    bson_destroy(&b);
+    CU_ASSERT_TRUE(ejdbsetindex(coll, "value", JBIDXNUM));
+}
+
 int main() {
 
     setlocale(LC_ALL, "en_US.UTF-8");
@@ -4290,7 +4304,8 @@ int main() {
             (NULL == CU_add_test(pSuite, "testTicket29", testTicket29)) ||
             (NULL == CU_add_test(pSuite, "testTicket28", testTicket28)) ||
             (NULL == CU_add_test(pSuite, "testTicket38", testTicket38)) ||
-            (NULL == CU_add_test(pSuite, "testTicket43", testTicket43))
+            (NULL == CU_add_test(pSuite, "testTicket43", testTicket43)) ||
+            (NULL == CU_add_test(pSuite, "testTicket54", testTicket54))
             ) {
         CU_cleanup_registry();
         return CU_get_error();