Add support for nsINativeTypes.STRING

RESOLVED FIXED

Status

()

Core
js-ctypes
RESOLVED FIXED
10 years ago
8 years ago

People

(Reporter: nossralf, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4pre) Gecko/2008020604 Minefield/3.0b4pre
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b3pre) Gecko/2008013122 Minefield/3.0b3pre 

As it stands, nsINativeTypes has a constant called STRING defined (corresponds to char* buffers) but no implementation exists for it. When declaring a library function where the return type or a parameter is nsINativeTypes.STRING no error is returned, but when the declared function is subsequently called from JavaScript, Firefox crashes due to ffi_prep_cif() receiving incomplete parameter information.

Reproducible: Always

Steps to Reproduce:
1.Open a shared library using js-ctypes.
2.Declare a function where a parameter or the return type is of type nsINativeTypes.STRING.
3.Attempt to call the declared function from JavaScript.
Actual Results:  
Firefox crashes due to a segmentation fault.

Expected Results:  
The function returns and Firefox doesn't segfault.
(Reporter)

Comment 1

10 years ago
Created attachment 301999 [details] [diff] [review]
tentative fix

This is a patch that simply follows the logic for WSTRING and adds support for STRING in nsNativeMethod::Execute.
landed, thanks
Status: UNCONFIRMED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
Component: js-ctypes → js-ctypes
Product: Other Applications → Core
You need to log in before you can comment on or make changes to this bug.