!urandom, version 9️⃣:maunium.net

set urself a laminated gif as pic!

46 Members
/myroomavatar34 Servers

Load older messages

15 Sep 2022
* @val:e2e.zoneval opens cpython's code15:22:50
@deepbluev7:neko.devNicoPost what you find :p15:23:19
@val:e2e.zonevalhuh that's funny15:33:55
@deepbluev7:neko.devNicoDoes it do "if hash -1, return -2"?15:34:23
@val:e2e.zonevalso, PyLongObject is a "subclass" of PyVarObject, which is the "class" of objects of variable length15:35:31
@val:e2e.zonevalPyVarObject has an ob_size field, used to store the size15:35:47
@val:e2e.zonevalbut it seems that in PyLongObject, it's also used to store the sign of the integer15:36:02
@val:e2e.zoneval(PyLongObject also contains a dynamically allocated array of digits)15:36:22
(gdb) p *((PyLongObject*) 140030768826608)
$5 = {ob_base = {ob_base = {ob_refcnt = 89, ob_type = 0x905f20 <PyLong_Type>}, ob_size = -1}, ob_digit = {1}}
(gdb) p *((PyLongObject*) 140030768826672)
$6 = {ob_base = {ob_base = {ob_refcnt = 377, ob_type = 0x905f20 <PyLong_Type>}, ob_size = 1}, ob_digit = {1}}
@val:e2e.zonevalrespectively -1 and 115:36:47
@val:e2e.zoneval then, when using hash() on these integer, this code runs: https://github.com/python/cpython/blob/b126196838bbaf5f4d35120e0e6bcde435b0b480/Objects/longobject.c#L3170-L3175 15:37:30
@val:e2e.zonevalPy_SIZE() is a getter for ob_size15:37:37
@val:e2e.zonevalso there is indeed a hardcoded -2 for when the long is -115:38:03
@deepbluev7:neko.devNicoTold ya!15:38:13
@deepbluev7:neko.devNicoIs PySIZE in bytes?15:39:03
@deepbluev7:neko.devNicoOr in 32bit words?15:39:09
@val:e2e.zoneval PySIZE has this type: https://docs.python.org/3/c-api/intro.html#c.Py_ssize_t 15:42:35
@val:e2e.zoneval it was explicitly hardcoded before the int/long merge https://github.com/python/cpython/blame/5b787e8bc2dbda5583eee039cb6a6e47c8d8a034/Objects/longobject.c#L1939-L1940 15:45:49
In reply to @val:e2e.zone
PySIZE has this type: https://docs.python.org/3/c-api/intro.html#c.Py_ssize_t
Yeah, but what does it count?
@val:e2e.zonevaloh I see why. C the function returning -1 probably has (or had) a special meaning15:47:42
@val:e2e.zonevalso they just want to avoid it15:47:54
@deepbluev7:neko.devNicoYes, it means not hashable15:47:56
@val:e2e.zonevalthere we go, then :D15:48:08
@thenamelesswonderer:thesilentlink.orgTheNamelessWondererSo the bot executes any code you give it? Isn't that a security risk?17:55:27
@thenamelesswonderer:thesilentlink.orgTheNamelessWonderer!sh rm17:56:25

Exited with code 1 in 28.7 ms. stderr:

BusyBox v1.35.0 (2022-07-06 19:09:49 UTC) multi-call binary.

Usage: rm [-irf] FILE...

Remove (unlink) FILEs

	-i	Always prompt before removing
	-f	Never prompt
	-R,-r	Recurse
@thenamelesswonderer:thesilentlink.orgTheNamelessWonderernice it doesn't stop rm...17:56:45

Show newer messages

Back to Room ListRoom Version: 9