Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Calculate rowPitch when hostPtr != and rowPitch == 0 #456

Closed
tonikitoo opened this Issue · 6 comments

2 participants

Antonio Gomes Sharath Kamath
Antonio Gomes
Owner

OpenCL 1.1 spec, page 76 says

"If host_ptr is not NULL and image_row_pitch = 0, image_row_pitch is calculated as
image_width * size of element in bytes."

Spotted by Anthony Liot in one of its translated demos.

Antonio Gomes tonikitoo referenced this issue from a commit
Antonio Gomes tonikitoo 2014-02-17 Antonio Gomes <a1.gomes@sisa.samsung.com>
        Calculate rowPitch when hostPtr != and rowPitch == 0
        Issue #456

        Spotted by Anthony Liot.

        This fixes a translated demo.

        * Modules/webcl/WebCLContext.cpp:
        (WebCore::WebCLContext::createImage):
f1ca984
Antonio Gomes tonikitoo referenced this issue from a commit
Antonio Gomes tonikitoo 2014-02-17 Antonio Gomes <a1.gomes@sisa.samsung.com>
        Calculate rowPitch when hostPtr != and rowPitch == 0
        Issue #456

        Spotted by Anthony Liot.

        This fixes a translated demo.

        * Modules/webcl/WebCLContext.cpp:
        (WebCore::WebCLContext::createImage):
a27b7ab
Antonio Gomes
Owner

Sharath had a good point about. Please work on a more reasonable solution.

Sharath Kamath
Collaborator

@tonikitoo Can you share details on the app that caught the error ?
Needed for testing.

Antonio Gomes
Owner

anthony, would you mind?

Antonio Gomes
Owner

actually, anthony did not provide a test cause of this issue. instead he described the situation, and I've made an speculative patch.

IIRC, something like hostPtr was being passed to createImage, but rowPitch was 0, and it was failing in

  • INVALID_HOST_PTR -- if hostPtr.byteLength < descriptor.rowPitch * descriptor.height

Maybe we should only do this check, if rowPitch > 0?

Sharath Kamath
Collaborator

No. This check has to be done even for default rowPitch = 0;
Because OpenCL wont know the length of the ArrayBuffer webcl is sending and it will just read ( rowPitch * height) data from the ArrayBuffer. So we have to validate with rowPitch = 0; also.

Yup will get this one up and maybe test the same in the test suite also,

Sharath Kamath SharathKamathK referenced this issue from a commit
Sharath Kamath SharathKamathK 2014-02-25 Sharath Kamath <s.kamath@samsung.com>
        Calculate rowPitch when hostPtr != and rowPitch == 0
        Issue #456

        Spotted by Anthony Liot.

        This fixes a translated demo.

        Validating the use sent rowPitch value, to avoid out of bound
        access of the hostPtr.
        Also validating the value as per specification conditions.

        * Modules/webcl/WebCLContext.cpp:
        (WebCore::WebCLContext::createImage):
0b401e8
Sharath Kamath
Collaborator
Sharath Kamath SharathKamathK closed this issue from a commit
Sharath Kamath SharathKamathK 2014-02-25 Sharath Kamath <s.kamath@samsung.com>
        Calculate rowPitch when hostPtr != NULL and rowPitch == 0

        Fixed #456

        Reviewed by Antonio Gomes.

        Spotted by Anthony Liot.

        This fixes a translated demo.

        Validating the use sent rowPitch value, to avoid out of bound
        access of the hostPtr.
        Also validating the value as per specification conditions.

        * Modules/webcl/WebCLContext.cpp:
        (WebCore::WebCLContext::createImage):
0d877ad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.