inner_int_inter.patch

text/x-patch

Filename: inner_int_inter.patch
Type: text/x-patch
Part: 0
Message: Bug in intarray?

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
contrib/intarray/_int_tool.c 1 1
diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c
index 79f018d..4d7a1f2 100644
--- a/contrib/intarray/_int_tool.c
+++ b/contrib/intarray/_int_tool.c
@@ -159,7 +159,7 @@ inner_int_inter(ArrayType *a, ArrayType *b)
 			i++;
 		else if (da[i] == db[j])
 		{
-			if (i + j == 0 || (i + j > 0 && *(dr - 1) != db[j]))
+			if (i + j == 0 || (i + j > 0 && (dr - ARRPTR(r)) == 0) || (i + j > 0 && *(dr - 1) != db[j]))
 				*dr++ = db[j];
 			i++;
 			j++;