Details
-
Task
-
Resolution: Fixed
-
Major
-
None
-
None
-
Security Level: Public
-
None
Description
The method description of increment indicates:
"Couchbase Server stores numbers as unsigned numbers, therefore if you try to increment an existing negative number, it will cause an integer overflow and return a non-logical numeric result. "
But, if the increment makes the value a positive number the increment is applied and integer overflow does not occur. The integer overflow occurs only if after the increment the value is still negative.
Example does not generate error:
require 'rubygems'
require 'couchbase'
client = Couchbase.connect("http://localhost:8091")
client.set("2",-1)
client.increment("2",2)
Example generates error:
require 'rubygems'
require 'couchbase'
client = Couchbase.connect("http://localhost:8091")
client.set("2",-3)
client.increment("2",2)