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

fix memory corruption in fhog #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion fdsst/fhog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ bool fhog( float *M, float *O, float *H, int h, int w, int binSize,
if(sz <= 0){
return false;
}
R1 = (float*) wrCalloc(wb*hb*nOrients*2,sizeof(float));
// __mm_storeu_ps will write 128 bits to address of pointer.
// It would cause memory corruption if memory allocated here is not large enough
R1 = (float*) wrCalloc(wb*hb*nOrients*2 + 4 ,sizeof(float));
gradHist( M, O, R1, h, w, binSize, nOrients*2, softBin, true );
// compute unnormalized contrast insensitive histograms
R2 = (float*) wrCalloc(wb*hb*nOrients,sizeof(float));
Expand Down