libretro / libretro/opera-libretro

a possible null pointer dereference?

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
86
Forks
50
Avg merge
7h 10m
Merged PRs (30d)
1

Description

Hi all,
There is a possible null pointer dereference issue found by Qihoo360 CodeSafe Team.
Details as bellow:

function FLAC__metadata_simple_iterator_get_block() may return a null pointer:
https://github.com/libretro/4do-libretro/blob/9d76c93c140d227211411b351ad03b8252d21a3a/deps/flac-1.3.2/src/libFLAC/metadata_iterators.c#L647-L674

before use the return value of function FLAC__metadata_simple_iterator_get_block(), there is no check against null:
https://github.com/libretro/4do-libretro/blob/9d76c93c140d227211411b351ad03b8252d21a3a/deps/flac-1.3.2/src/libFLAC/metadata_iterators.c#L309

since in function FLAC__metadata_simple_iterator_get_block(), there is a check against null pointer (0), and an ERROR status (FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR) is set to 'iterator->status' when the return value is a null pointer, it will be better if a checking against null (either by checking the pointer or by the status is ok).

Cheers
Qihoo360 CodeSafe Team

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in deps/flac-1.3.2/src/libFLAC/metadata_iterators.c, examining FLAC__metadata_simple_iterator_get_block() at lines 647-674 and its use near line 309. Trace how the iterator status and returned block are handled, then verify that the null-return path is safely covered without changing normal metadata iteration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.