Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More fun with valgrind [OLD #21] #12

Closed
MichaelChirico opened this issue Sep 30, 2019 · 0 comments
Closed

More fun with valgrind [OLD #21] #12

MichaelChirico opened this issue Sep 30, 2019 · 0 comments

Comments

@MichaelChirico
Copy link
Owner

@MichaelChirico MichaelChirico commented Sep 30, 2019

Valgrind detected:

> gh_encode(2.345, 6.789)
==44279== Use of uninitialised value of size 8
==44279==    at 0x48AC549: interleaved_to_geohashstr(unsigned short*, unsigned long, char*, unsigned long) [clone .part.0] (packages/tests-vg/geohashTools/src/geohash.cpp:209)
==44279==    by 0x48AD3FC: interleaved_to_geohashstr (packages/tests-vg/geohashTools/src/geohash.cpp:160)
==44279==    by 0x48AD3FC: geohash_encode_impl (packages/tests-vg/geohashTools/src/geohash.cpp:230)
==44279==    by 0x48AD3FC: gh_encode_(Rcpp::Vector<14, Rcpp::PreserveStorage>, Rcpp::Vector<14, Rcpp::PreserveStorage>, int) (packages/tests-vg/geohashTools/src/geohash.cpp:327)
==44279==    by 0x48A6810: _geohashTools_gh_encode_ (packages/tests-vg/geohashTools/src/RcppExports.cpp:17)
==44279==    by 0x4D18BF: bcEval (svn/R-devel/src/main/eval.c:7293)
==44279==    by 0x4E4F4F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==44279==    by 0x4E6A9E: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==44279==    by 0x4E77E4: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==44279==    by 0x4D6454: bcEval (svn/R-devel/src/main/eval.c:6743)
==44279==    by 0x4E4F4F: Rf_eval (svn/R-devel/src/main/eval.c:620)
==44279==    by 0x4E6A9E: R_execClosure (svn/R-devel/src/main/eval.c:1780)
==44279==    by 0x4E77E4: Rf_applyClosure (svn/R-devel/src/main/eval.c:1706)
==44279==    by 0x4E5044: Rf_eval (svn/R-devel/src/main/eval.c:743)
==44279==  Uninitialised value was created by a stack allocation
==44279==    at 0x48A4080: ??? (in /data/blackswan/ripley/R/packages/tests-vg/geohashTools.Rcheck/geohashTools/libs/geohashTools.so)
==44279== 
[1] "s0kv66"

It appears to be valid -- this loop may access j beyond which dst was initialized:

	for(unsigned int j=0; j<dst_length; j++){
	  Rprintf("Accessing dst[%d]\n", j);
    // 0x1f = 00011111 blanks the leftmost 3 bits to ensure value in [0, 31]
		dst[j] = map[dst[j]&0x1F];
	}

Closed in 73ea7aa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.