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

Parsing at invalid root #12

Open
bertschneider opened this issue Mar 22, 2018 · 0 comments
Open

Parsing at invalid root #12

bertschneider opened this issue Mar 22, 2018 · 0 comments

Comments

@bertschneider
Copy link

When trying to use none MAM addresses as root the library sometimes throws an error Invalid addresses input or something like that. That is ok and the expected behavior. But sometimes a "thread panic" is produced and I guess that should not happen.

Here is an example with such an address:

const IOTA = require('iota.lib.js');
const Mam = require('mam.client.js/lib/mam.node');

const iota = new IOTA({ provider: 'https://field.carriota.com:443' });
console.log('Connected to:', iota.provider);

Mam.init(iota);

const fetchMamAtRoot = async (root) => {
    console.log('Fetching MAM at root:', root);
    try {
        return await Mam.fetch(root);
    } catch (e) {
        console.log(e);
    }
};
fetchMamAtRoot('YQHVRO9JODMBLKO9AZJLZDAWGNODOCF9UFUTXXO9JSLYPKOKVZHADMIILBRP9RTETQ9QRIFZACTBBIUPD');

Running the code I get the following output:

Connected to: https://field.carriota.com:443
Fetching MAM at root: YQHVRO9JODMBLKO9AZJLZDAWGNODOCF9UFUTXXO9JSLYPKOKVZHADMIILBRP9RTETQ9QRIFZACTBBIUPD
thread '<unnamed>' panicked at 'index 3 out of range for slice of length 0', /checkout/src/libcore/slice/mod.rs:746:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to parse:  5275984

I tried it on macOS 10.13.13, node v9.6.1.

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