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

Add CHECKs to prevent segfault for incorrect IMAGE_DATA layers. #1551

Merged
merged 1 commit into from Dec 20, 2014
Merged

Add CHECKs to prevent segfault for incorrect IMAGE_DATA layers. #1551

merged 1 commit into from Dec 20, 2014

Conversation

schenker
Copy link
Contributor

Incomplete IMAGE_DATA layers cause a segmentation fault, e.g.:

layers {
name: "mnist"
type: IMAGE_DATA
top: "data"
top: "label"
image_data_param {
batch_size: 100
}
include: { phase: TRAIN }
}

or

layers {
name: "mnist"
type: IMAGE_DATA
top: "data"
top: "label"
data_param {
source: "./data/train.txt"
batch_size: 100
}
include: { phase: TRAIN }
}

Also empty image list files cause a segfault.
This is fixed by adding 2 CHECK instructions to ImageDataLayer::DataLayerSetUp()

@schenker
Copy link
Contributor Author

@shelhamer @jeffdonahue what do you think?

@@ -29,6 +29,8 @@ void ImageDataLayer<Dtype>::DataLayerSetUp(const vector<Blob<Dtype>*>& bottom,
const string& source = this->layer_param_.image_data_param().source();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about a CHECK_GT(source.size(), 0)? Leaving it unspecified seems like the most common error mode so it would be good to have an error message specifically for that case.

@jeffdonahue
Copy link
Contributor

Thanks @schenker, see my comments and I'll merge.

@schenker
Copy link
Contributor Author

@jeffdonahue i applied your suggestions. travis build timed out, but for me the tests succeed.

@jeffdonahue
Copy link
Contributor

Thanks, changes look good; please squash into a single commit for merge.

Incomplete IMAGE_DATA layers cause a segmentation fault, e.g.:

layers {
  name: "mnist"
  type: IMAGE_DATA
  top: "data"
  top: "label"
  image_data_param {
    batch_size: 100
  }
  include: { phase: TRAIN }
}

or

layers {
  name: "mnist"
  type: IMAGE_DATA
  top: "data"
  top: "label"
  data_param {
    source: "./data/train.txt"
    batch_size: 100
  }
  include: { phase: TRAIN }
}

Also empty image list files cause a segfault.
This is fixed by adding 3 CHECK instructions.
@schenker
Copy link
Contributor Author

squashed it @jeffdonahue

jeffdonahue added a commit that referenced this pull request Dec 20, 2014
Add CHECKs to prevent segfault for incorrect IMAGE_DATA layers.
@jeffdonahue jeffdonahue merged commit 4926615 into BVLC:master Dec 20, 2014
@jeffdonahue
Copy link
Contributor

Thanks @schenker!

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

Successfully merging this pull request may close these issues.

None yet

2 participants