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

Attempting to access memory outside the buffer #86

Open
danelo11 opened this issue May 12, 2020 · 2 comments
Open

Attempting to access memory outside the buffer #86

danelo11 opened this issue May 12, 2020 · 2 comments

Comments

@danelo11
Copy link

Hello I'm trying to receive advertisement packets from a BLE device running the code provided below, but i get this error:

internal/buffer.js:75
throw new ERR_BUFFER_OUT_OF_BOUNDS();
^

RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds
at boundsError (internal/buffer.js:75:11)
at Buffer.readUInt8 (internal/buffer.js:243:5)
at Hci.processCmdCompleteEvent (C:\Users\Dlorente\PFG\node_modules@abandonware\noble\lib\hci-socket\hci.js:564:27)
at Hci.onSocketData (C:\Users\Dlorente\PFG\node_modules@abandonware\noble\lib\hci-socket\hci.js:459:12)
at BluetoothHciSocket.emit (events.js:310:20)
at BluetoothHciSocket.onHciEventEndpointData (C:\Users\Dlorente\PFG\node_modules@abandonware\bluetooth-hci-socket\lib\usb.js:191:10)
at InEndpoint.emit (events.js:310:20)
at Transfer.transferDone (C:\Users\Dlorente\PFG\node_modules\usb\usb.js:441:9) {
code: 'ERR_BUFFER_OUT_OF_BOUNDS'
}


Code I'm using:

const noble = require('@abandonware/noble');
const util = require('util');
const sleepy = util.promisify(setTimeout);

var macs = ['']; //here is where I specify the MacAddress of my BLE device

noble.on('stateChange', async function state(state, errStates){
try{
if(state == 'poweredOn'){
const devices = await noble.startScanningAsync([], true)
.then(function (){
console.log("Scan started...");
})
}
}catch(errStates){
console.log(errStates);
}
});

noble.on('discover', function(devices){
for (var i=0;i<=macs.length;i++){
if(${devices.address} == macs[i]){
const adman = devices.advertisement;
console.log(\t${JSON.stringify(adman)});
}
}
});


I'm using:
Windows 10
node v12.16.3
npm 6.14.4

Thank you in advance

@danelo11
Copy link
Author

Hello
I discover that I have the exact same output error if I try to run advertisement-discovery.js which is the test script that ensures if everything is properly configured or not. Maybe that can helpful in order to find the issue.
Thank you

@danelo11
Copy link
Author

Hi again
As I was typing my last message I found the way to solve it. Basically it was a matter of chainging the driver with the Zadig tool. Now aparently all works fine.
Thank you

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

No branches or pull requests

1 participant