kopia lustrzana https://gitlab.com/sane-project/backends
Merge branch 'genesys-crash-bugs' into 'master'
genesys: Fix several bugs that can potentially crash the backend See merge request sane-project/backends!459merge-requests/463/merge
commit
d7f930252b
|
@ -349,7 +349,8 @@ bool ImagePipelineNodeInvert::get_next_row_data(std::uint8_t* out_data)
|
|||
}
|
||||
case 1: {
|
||||
auto* data = out_data;
|
||||
for (std::size_t i = 0; i < num_values; ++i) {
|
||||
auto num_bytes = (num_values + 7) / 8;
|
||||
for (std::size_t i = 0; i < num_bytes; ++i) {
|
||||
*data = ~*data;
|
||||
data++;
|
||||
}
|
||||
|
@ -499,6 +500,12 @@ ImagePipelineNodeComponentShiftLines::ImagePipelineNodeComponentShiftLines(
|
|||
static_cast<unsigned>(source.get_format()));
|
||||
}
|
||||
extra_height_ = *std::max_element(channel_shifts_.begin(), channel_shifts_.end());
|
||||
height_ = source_.get_height();
|
||||
if (extra_height_ > height_) {
|
||||
height_ = 0;
|
||||
} else {
|
||||
height_ -= extra_height_;
|
||||
}
|
||||
}
|
||||
|
||||
bool ImagePipelineNodeComponentShiftLines::get_next_row_data(std::uint8_t* out_data)
|
||||
|
@ -547,6 +554,12 @@ ImagePipelineNodePixelShiftLines::ImagePipelineNodePixelShiftLines(
|
|||
}
|
||||
|
||||
extra_height_ = *std::max_element(pixel_shifts_.begin(), pixel_shifts_.end());
|
||||
height_ = source_.get_height();
|
||||
if (extra_height_ > height_) {
|
||||
height_ = 0;
|
||||
} else {
|
||||
height_ -= extra_height_;
|
||||
}
|
||||
}
|
||||
|
||||
bool ImagePipelineNodePixelShiftLines::get_next_row_data(std::uint8_t* out_data)
|
||||
|
|
|
@ -393,7 +393,7 @@ public:
|
|||
unsigned shift_r, unsigned shift_g, unsigned shift_b);
|
||||
|
||||
std::size_t get_width() const override { return source_.get_width(); }
|
||||
std::size_t get_height() const override { return source_.get_height() - extra_height_; }
|
||||
std::size_t get_height() const override { return height_; }
|
||||
PixelFormat get_format() const override { return source_.get_format(); }
|
||||
|
||||
bool eof() const override { return source_.eof(); }
|
||||
|
@ -403,6 +403,7 @@ public:
|
|||
private:
|
||||
ImagePipelineNode& source_;
|
||||
std::size_t extra_height_ = 0;
|
||||
std::size_t height_ = 0;
|
||||
|
||||
std::array<unsigned, 3> channel_shifts_;
|
||||
|
||||
|
@ -419,7 +420,7 @@ public:
|
|||
const std::vector<std::size_t>& shifts);
|
||||
|
||||
std::size_t get_width() const override { return source_.get_width(); }
|
||||
std::size_t get_height() const override { return source_.get_height() - extra_height_; }
|
||||
std::size_t get_height() const override { return height_; }
|
||||
PixelFormat get_format() const override { return source_.get_format(); }
|
||||
|
||||
bool eof() const override { return source_.eof(); }
|
||||
|
@ -429,6 +430,7 @@ public:
|
|||
private:
|
||||
ImagePipelineNode& source_;
|
||||
std::size_t extra_height_ = 0;
|
||||
std::size_t height_ = 0;
|
||||
|
||||
std::vector<std::size_t> pixel_shifts_;
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ struct SetupParams {
|
|||
|
||||
ColorFilter color_filter = static_cast<ColorFilter>(NOT_SET);
|
||||
|
||||
ScanFlag flags;
|
||||
ScanFlag flags = ScanFlag::NONE;
|
||||
|
||||
unsigned get_requested_pixels() const
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue