Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

prevent segfault caused by bitidx++#80

Merged
tdicola merged 1 commit intoadafruit:masterfrom
larsks:master
May 31, 2014
Merged

prevent segfault caused by bitidx++#80
tdicola merged 1 commit intoadafruit:masterfrom
larsks:master

Conversation

@larsks
Copy link
Copy Markdown
Contributor

@larsks larsks commented May 16, 2014

This patch modifies Adafruit_DHT_Driver/Adafruit_DHT.c so that the code
that increments bitidx without bound is protected by #ifdef DEBUG.
This prevents this code from generating a segfault if readDHT is called several
times (which will ultimately cause bitidx to increment beyond the end of the
bits array).

Resolves github issue #78.

This patch modifies Adafruit_DHT_Driver/Adafruit_DHT.c so that the code
that increments `bitidx` without bound is protected by #ifdef DEBUG.
This prevents this code from generating a segfault if readDHT is called several
times (which will ultimately cause bitidx to increment beyond the end of the
bits array).

Resolves github issue adafruit#78.
@tdicola
Copy link
Copy Markdown
Contributor

tdicola commented May 31, 2014

Thanks for sending the pull request. I just started looking at the DHT sensors and this looks like a good quick fix to take so folks don't run into issues adapting the code to something that runs continuously. I tried the change in a modified version of the example which continually grabs a reading and sleeps for a second--no stability issues with the fix. Thanks!

tdicola added a commit that referenced this pull request May 31, 2014
prevent segfault caused by bitidx++
@tdicola tdicola merged commit 7152d6d into adafruit:master May 31, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants