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

Fix Bug 1246 #1248

Closed
wants to merge 3 commits into from
Closed

Fix Bug 1246 #1248

wants to merge 3 commits into from

Conversation

dreamsxin
Copy link
Contributor

Use imagecreatefromstring replace imagecreatefrompng
See #1246

@ghost
Copy link

ghost commented Sep 18, 2013

I am afraid this does not resolve the issue.

valgrind complains that "Conditional jump or move depends on uninitialised value(s)"; this means that you have an if or switch that depends on an uninitialized variable. valgrind suggests that it happens here: phalcon_call_func_p1_ex(image, &image, "imagecreatefrompng", realpath);, however, realpath and image are initialized.

The parent condition is switch (Z_LVAL_P(type)) — it is possible that type is not initialized.

Indeed,

zval *type;

if (phalcon_array_isset_long_fetch(&type, imageinfo, 2)) {
    phalcon_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC);
}

However, if $imageinfo[2] is not set, type will contain garbage and this results in an error.

I would suggest something like this — please check if this is an appropriate solution:

if (phalcon_array_isset_long_fetch(&type, imageinfo, 2)) {
    phalcon_update_property_this(this_ptr, SL("_type"), type TSRMLS_CC);
}
else {
    PHALCON_INIT_VAR(type);
    ZVAL_LONG(type, -1); /* or any other value denoting that the image type is not valid */
}

@dreamsxin dreamsxin closed this Sep 18, 2013
@dreamsxin dreamsxin deleted the bug_1246 branch September 18, 2013 07:11
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.

1 participant