Repository navigation
Conversation
…tration_table Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 6, 2026
kebasaa
added a commit
to kebasaa/libfreenect
that referenced
this pull request
Nov 9, 2026
…s checks
- The registration block (command 0x16, parameter 0x40) is read once in
freenect_camera_init() for 640x480 at 30 fps, as Microsoft's init
script does ([0x40, 0, 1, 30, 0], §20.1.1). It was read again at every
freenect_set_video_mode() with that mode's resolution, which the 1414
refuses for hi-res colour ("read 4 bytes (expected 118)"); the mapping
for every colour resolution uses the 640x480 block (§20.5.2).
- Every table allocation is checked (the idea of upstream PR OpenKinect#698, for
all of them): freenect_init_registration() returns -1 and
freenect_start_depth() fails instead of writing through NULL;
freenect_copy_registration() returns NULL tables when out of memory.
- freenect_map_rgb_to_depth() returns without doing anything when its
arguments are NULL or the device has no registration tables (depth not
started in a millimetre mode), skips 10000 mm (FREENECT_DEPTH_MM's
saturation value, one past the end of the shift table) and drops
colour rows outside the image instead of writing out of bounds.
- freenect_camera_to_world() and freenect_destroy_registration() accept
NULL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
freenect_init_registration_table()insrc/registration.ccallsmalloc()twice (lines 289-290) to allocateregtable_dxandregtable_dy, then immediately passes the results tomemset()(lines 291-292) without checking forNULL. If either allocation fails,memset()dereferences a null pointer, causing a segfault.Fix
NULLcheck after eachmalloc()callPoC
Result:
How it was found
This bug was identified as PROP-N4-npd-005 during a SPECA security audit.