If the keypoints are detected properly but the program crashes when generating the descriptors it is because the descriptor region (which surrounds the keypoint) comes out of the image and there is a memory access to a position that does not exist.
You have to somehow limit the operating region for freak descriptors.