Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#865 closed defect (duplicate)

Accessing first element of empty vector

Reported by: vorner Owned by:
Priority: medium Milestone:
Component: Unclassified Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 0.0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

If built with _GLIBCXX_DEBUG, tests fail with:

[ RUN      ] Base64Test.decode
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/debug/vector:272:
    error: attempt to subscript container with out-of-bounds index 0, but
    container only holds 0 elements.

[ RUN      ] Rdata_Unknown_Test.createFromText
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/include/g++-v4/debug/vector:272:
    error: attempt to subscript container with out-of-bounds index 0, but
    container only holds 0 elements.

I suspect this might be some kind of this code:

vector<uint8_t> v;
void *ptr = &v[0];

Maybe these two errors are because of the same piece of code, so they are in single ticket.

Subtickets

Change History (3)

comment:1 Changed 9 years ago by jinmei

I guess this was already reported by Francis (and we had a ticket
for this). Try seach trac.

comment:2 Changed 9 years ago by vorner

  • Resolution set to duplicate
  • Status changed from new to closed

Yes, you're right, I didn't search hard enough. It's #386.

comment:3 Changed 9 years ago by shane

  • Milestone New Tasks deleted
Note: See TracTickets for help on using tickets.