On 3/16/15 11:07 AM, Alvaro Herrera wrote:
> Support opfamily members in get_object_address
I get compiler warnings from this:
objectaddress.c: In function ‘get_object_address’:
objectaddress.c:1428:12: warning: array subscript is above array bounds
[-Warray-bounds]
objectaddress.c:1430:11: warning: array subscript is above array bounds
[-Warray-bounds]
This looks fishy:
1423 i = 0;
1424 foreach (cell, objargs)
1425 {
1426 ObjectAddress typaddr;
1427
1428 typenames[i] = strVal(lfirst(cell));
1429 typaddr = get_object_address_type(OBJECT_TYPE, cell, missing_ok);
1430 typeoids[i] = typaddr.objectId;
1431 if (i++ >= 2)
1432 break;
1433 }
Since you're using a postfix increment, the loop will execute with i =
2, which will lead to the array bounds violation.