Skip to content

Null pointer dereferencing #382

Closed
Closed
@gcode-importer

Description

Originally reported on Google Code with ID 382

see http://www.viva64.com/en/b/0271/#ID0EWAAG

bool j2k_write_rgn(....)
{
  OPJ_BYTE * l_current_data = 00;
  OPJ_UINT32 l_nb_comp;
  OPJ_UINT32 l_rgn_size;
  opj_image_t *l_image = 00;
  opj_cp_t *l_cp = 00;
  opj_tcp_t *l_tcp = 00;
  opj_tccp_t *l_tccp = 00;
  OPJ_UINT32 l_comp_room;

  // preconditions
  assert(p_j2k != 00);
  assert(p_manager != 00);
  assert(p_stream != 00);

  l_cp = &(p_j2k->m_cp);
  l_tcp = &l_cp->tcps[p_tile_no];
  l_tccp = &l_tcp->tccps[p_comp_no];

  l_nb_comp = l_image->numcomps;
  ....
}

PVS-Studio's diagnostic message: V522 Dereferencing of the null pointer 'l_image' might
take place. j2k.c 5205

The 'l_image' pointer is initialized to zero and is not changed anywhere after that.
So, when calling the j2k_write_rgn() function, the null pointer will be dereferenced.

Reported by detonin on 2014-08-24 21:00:25

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions