Skip to content

Commit

Permalink
#36 Fix segmentation fault
Browse files Browse the repository at this point in the history
  • Loading branch information
jmonterrubio committed Jul 16, 2021
1 parent 4078544 commit b815f7b
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog).

## [Unreleased](https://github.com/idealista/yatm/tree/develop)
## [2.1.2](https://github.com/idealista/yatm/tree/2.1.2)
### Fixed
- [#36](https://github.com/idealista/yatm/issues/36) *Fix another segmentation fault* @jmonterrubio
## [2.1.1](https://github.com/idealista/yatm/tree/2.1.1)
### Fixed
- [#36](https://github.com/idealista/yatm/issues/36) *Fix segmentation fault* @jmonterrubio
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pkg: "{{ item }}"
state: present
with_items:
- libturbojpeg0-dev
- libjpeg62-turbo-dev
- libtiff-dev
- libgsf-1-dev
- liblcms2-dev
Expand Down
5 changes: 2 additions & 3 deletions molecule/default/group_vars/yatm/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

nodejs_version: 14.17.0

vips_version: 8.11.2
# vips_force_reinstall: true
vips_version: 8.10.0

yatm_install_path: /opt/yatm

Expand All @@ -28,7 +27,7 @@ yatm_build_libraries:
- /usr/lib/x86_64-linux-gnu/libSM
- /usr/lib/x86_64-linux-gnu/libICE
- /usr/lib/x86_64-linux-gnu/libpng
- /usr/lib/x86_64-linux-gnu/libturbojpeg
- /usr/lib/x86_64-linux-gnu/libjpeg
- /usr/lib/x86_64-linux-gnu/libtiff
- /usr/lib/x86_64-linux-gnu/libgsf-1
- /usr/lib/x86_64-linux-gnu/liblcms2
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "yatm",
"description": "Yet Another Thumbnail Manager. A libvips wrapper for Node.js",
"author": "idealista <[email protected]> (http://www.idealista.com/labs/blog/)",
"version": "2.1.1",
"version": "2.1.2",
"homepage": "https://github.com/idealista/yatm",
"private": false,
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace image {

Image* Init(void *buffer, size_t const length) {
Image *thumb = NULL;
VipsImage *out = vips_image_new_from_buffer(buffer, length, "", "access", VIPS_ACCESS_RANDOM, NULL);
VipsImage *out = vips_image_new_from_buffer(buffer, length, NULL, "access", VIPS_ACCESS_RANDOM, NULL);
if (out != NULL) {
thumb = new Image;
thumb->img = out;
Expand Down
37 changes: 37 additions & 0 deletions test/unit/resize.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
'use strict';

var fs = require('fs');
var thumb = require('../../index');

var image1 = 'test/unit/images/1.png';
var buffer1 = fs.readFileSync(image1);
var image2 = 'test/unit/images/1.jpg';
var buffer2 = fs.readFileSync(image2);

module.exports = {
setUp : function(callback) {
Expand All @@ -26,6 +30,39 @@ module.exports = {
}
);
},
testResizeBasicBuffer: function(assert) {
thumb(buffer1)
.resize(this.options.width,this.options.height)
.toBuffer(
function (err, data) {
assert.ok(!err, 'unexpected error: ' + err);
assert.notEqual(data, undefined);
assert.done();
}
);
},
testResizeBasicJpg: function(assert) {
thumb(image2)
.resize(this.options.width,this.options.height)
.toBuffer(
function (err, data) {
assert.ok(!err, 'unexpected error: ' + err);
assert.notEqual(data, undefined);
assert.done();
}
);
},
testResizeBasicBufferJpg: function(assert) {
thumb(buffer2)
.resize(this.options.width,this.options.height)
.toBuffer(
function (err, data) {
assert.ok(!err, 'unexpected error: ' + err);
assert.notEqual(data, undefined);
assert.done();
}
);
},
testResizeNoHeight: function(assert) {
assert.throws(function(){
thumb(image1)
Expand Down

0 comments on commit b815f7b

Please sign in to comment.