… | |
… | |
1420 | * assertion with -DDEBUGGING, although SvCUR is documented to |
1420 | * assertion with -DDEBUGGING, although SvCUR is documented to |
1421 | * return the xpv_cur field which certainly exists after upgrading. |
1421 | * return the xpv_cur field which certainly exists after upgrading. |
1422 | * according to nicholas clark, calling SvPOK fixes this. |
1422 | * according to nicholas clark, calling SvPOK fixes this. |
1423 | * But it doesn't fix it, so try another workaround, call SvPV_nolen |
1423 | * But it doesn't fix it, so try another workaround, call SvPV_nolen |
1424 | * and hope for the best. |
1424 | * and hope for the best. |
|
|
1425 | * Damnit, SvPV_nolen still trips over yet another assertion. This |
|
|
1426 | * assertion business is seriously broken, try yet another workaround |
|
|
1427 | * for the broken -DDEBUGGING. |
1425 | */ |
1428 | */ |
1426 | #ifdef DEBUGGING |
1429 | #ifdef DEBUGGING |
1427 | SvPV_nolen (string); |
1430 | offset = SvOK (string) ? sv_len (string) : 0; |
|
|
1431 | #else |
|
|
1432 | offset = SvCUR (string); |
1428 | #endif |
1433 | #endif |
1429 | |
1434 | |
1430 | if (SvCUR (string) > json->max_size && json->max_size) |
1435 | if (offset > json->max_size && json->max_size) |
1431 | croak ("attempted decode of JSON text of %lu bytes size, but max_size is set to %lu", |
1436 | croak ("attempted decode of JSON text of %lu bytes size, but max_size is set to %lu", |
1432 | (unsigned long)SvCUR (string), (unsigned long)json->max_size); |
1437 | (unsigned long)SvCUR (string), (unsigned long)json->max_size); |
1433 | |
1438 | |
1434 | if (json->flags & F_UTF8) |
1439 | if (json->flags & F_UTF8) |
1435 | sv_utf8_downgrade (string, 0); |
1440 | sv_utf8_downgrade (string, 0); |