Fixed a bug with File.infoGet() and File.getInfo() methods that sometime... #1

wants to merge 1 commit into


None yet
1 participant

ivmaykov commented Feb 3, 2012

...s caused segfaults

The problem is that the stack-allocated info structure is not being zeroed-out before the call to apr_file_info_get(). That function doesn't seem to zero it out either, and only sets the requested fields. As a result, the string pointers info->fname and info->name can point at random memory locations, which can crash the JVM with a segfault when it attempts to copy the file info fields from the C struct to the Java FileInfo instance in fill_finfo() - specifically, the NewStringUTF() call that copies the fname and name strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment