Skip Menu |

This queue is for tickets about the Pg-hstore CPAN distribution.

Report information
The Basics
Id: 77498
Status: resolved
Priority: 0/
Queue: Pg-hstore

People
Owner: ALT [...] cpan.org
Requestors: mk [...] bluepipe.dk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.02
Fixed in: (no value)



Subject: Segmentation fault because of comment
At least on my system a single line comment which ends in \ will also take next line as a comment. This causes problems for the realloc part of the encode code since the buf_len isn't increased. As a patch I've added a single space after the backslash which makes the code work on my system and shouldn't cause any problem.
Subject: hstore.patch
--- hstore.xs 2012-05-28 11:27:23.000000000 +0200 +++ hstore.xs_fix 2012-05-28 11:27:56.000000000 +0200 @@ -90,7 +90,7 @@ // Check we have buf mem if( (buf_fill+(vallen+keylen)*2+10) > buf_len ) { //Add 10 cus it can be 4x'"', 1x' => ', 1x', ' - //We mul to 2 cus each character can be escaped with \ + //We mul to 2 cus each character can be escaped with \ buf_len += (vallen+keylen)*2+10+ENCODE_BUF; char *newbuf = (char*)realloc(buf, buf_len); if( newbuf == NULL ) {
From: mk [...] bluepipe.dk
Whoops, the above patch doesn't seem to work after all, sorry. I've added a new one where a put the backslash inside quotes: '\' and that seems to work. Best regards Martin
Subject: hstore.patch
--- hstore.xs.orig 2012-05-28 11:39:19.000000000 +0200 +++ hstore.xs 2012-05-28 11:39:41.000000000 +0200 @@ -90,7 +90,7 @@ // Check we have buf mem if( (buf_fill+(vallen+keylen)*2+10) > buf_len ) { //Add 10 cus it can be 4x'"', 1x' => ', 1x', ' - //We mul to 2 cus each character can be escaped with \ + //We mul to 2 cus each character can be escaped with '\' buf_len += (vallen+keylen)*2+10+ENCODE_BUF; char *newbuf = (char*)realloc(buf, buf_len); if( newbuf == NULL ) {
Fixed. need some time to spread over cpan