duangsuse::Echo
709 subscribers
4.23K photos
127 videos
583 files
6.44K links
import this:
美而不丑、明而不暗、短而不凡、长而不乱,扁平不宽,读而后码,行之天下,勿托地上天国。
异常勿吞,难过勿过,叹一真理。效率是很重要,盲目最是低效。
简明是可靠的先验,不是可靠的祭品。
知其变,守其恒,为天下式;穷其变,知不穷,得地上势。知变守恒却穷变知新,我认真理,我不认真。

技术相干订阅~
另外有 throws 闲杂频道 @dsuset
转载频道 @dsusep
极小可能会有批评zf的消息 如有不适可退出
suse小站(面向运气编程): https://WOJS.org/#/
Download Telegram
Forwarded from DogeSpeed广播
#通知

目前集群基本设置已经完成,备用节点应该已经恢复

小科普:一只狗的寿命通常在 10 – 13 年之间
#security #google Chrome 新 0day (audio component, use-after-free) (CVE-2019-13720)
影响版本 <=78.0.3904.87
据说已经牛逼到可以沙箱(当然我不知道是哪里的沙箱)遁出、甚至可以 RCE 了

很辣鸡的事情……

The exploit attempts to perform numerous operations to allocate/free memory along with other techniques that eventually give the attackers an arbitrary read/write primitive. This is used to craft a special object that can be used with WebAssembly and FileReader together to perform code execution for the embedded shellcode payload.

The exploit first tries to trigger UaF(use-after-free) to perform an information leak about important 64-bit addresses (as a pointer). This results in a few things: 1) if an address is leaked successfully, it means the exploit is working correctly; 2) a leaked address is used to know where the heap/stack is located and that defeats the address space layout randomization (ASLR) technique; 3) a few other useful pointers for further exploitation could be located by searching near this address.

https://securelist.com/chrome-0-day-exploit-cve-2019-13720-used-in-operation-wizardopium/94866/
Forwarded from chx818🇨🇳 高考奋斗中|代购泰国原生ip小鸡|公益机场
chrome漏洞,建议立刻升级

#Google is warning Windows, Mac, #Linux users to update their #Chrome browser (to 78.0.3904.87) immediately due to a security vulnerability (CVE-2019-13720) that attackers are actively exploiting in the wild to hijack computers.
Screenshot_2019_11_03_我_本无意_你_可是.png
35.1 KB
woc,找居然到了
duangsuse::Echo
https://duangsuse-valid-projects.github.io/Share/zhuazhou/#%E7%AC%AC%E4%B8%80%E7%AB%A0-%E6%8A%93%E5%91%A8
写不下去了,我打算在修了我的 Doku 后写一门 JVM 脚本语言…… 即便我还有其他事情可以安排
我觉得那些真的好有意思,写文字不仅慢,而且好没意思……
所以大概我是写不下去这篇『小说』了吧……
不过本小说是『实用』小说,所以不需要写太多,只要有用就好。
说起来,这篇文章的脚本我不是不想用 ES6,可是我这本来 GitHub Pages 的 Jekyll build 也不能用插件…… 我也不想用什么 CI……
自己在本地编译又有点麻烦,而且导致一些问题,非常不爽啊,我很讨厌 for(var i... 和到处 function(it) ....

本文提供 waits.js, toc_tree.js, article_split.js, nsfw_switcher.js, night.js 插件来提升阅读体验,都是我从零彻底重写的
其实里面有很多复用做的并不好,比如说我手写了『交集 (intersection)』算法(其实是 comple…… 补集),比如

inline fun enableOn<reified W>(k: Element.ID) = W(helem(k)).also { it.enable() }

因为没有 T.prototype.also(op: (T) -> undefined) 我只能写成

function enableOn(k, w) {
var inst = new w(k); inst.enable();
return inst;
}


总觉得怪怪的,我的 tocTree 也可以利用 tocTree.config.onHeading(layer, hl); tocTree.config.onItem(layer, e) 来增加扩展性,可我觉得意义不大

不过我的 toc 递归倒是还蛮舒服 parseRec(div, mut i0, mut lev) -> [int, Subree]
我要给 Dokuss 库修一个严重的 bug,这个 bug 导致它不能正常读取有符号的多字节整形

这个问题是因为 JVM 的 shl/shr 没有按照我的预期,设置和移除符号位的原因

(0x80_00_00_00).shr(31)

这个数,它实际上已经是 kotlin.Long 了(超过了 31 位),不过看起来是 32 位的样子

它的第一个十六进制位用二进制表示是 0b1000,首位不为零
而这个数值左移一位,就是 0b0100,0x7

(0x80_00_00_00).toInt() // -2147483648

不过如果用 Long 操作,符号位会被考虑进转化结果里

但是很多时候是用 Int 的,这样一些东西就不能设置好了…… 不过目前好像还没确定是这个问题?

from struct import pack, unpack

def swap(i): return unpack('<i', pack('>i', i))



(1).shl(31) // -2147483648

不对啊!完全符合预期好不好?到底是哪里出了问题?
🤔 我对 UTF-16 读取不好的问题,已经完全放弃了,看起来像是我漏了什么,包括我用 radare2 看 hex 的结果都不一样
果然是 UTF-8 和 UTF-16 编码不兼容的问题…… 我这里 r2 上看到的『恭喜发财』是 3*4 字节,也难怪了
效果很好,不过组合解析器好像有问题……
本来这次回来也是要解决一个关于 signbit 的有点难受的 bug 的,看起来是不必解决了,虽然这个问题我想解决的话也有点勉强……
手工测试通过……
不过,这样的かんば て,也是不能继续太久的呢…… 至少身体条件不允许啊,现在又要去上学了

即便可以的话,虽然看起来现在是好多了,也不觉得自己是能够立刻解决所有问题的天才啊,很多在学校想一会的问题,到这里来,我都得想很久才能实现(有的时候也是因为开始想的幼稚,不过不上机居然是最快的)
duangsuse::Echo
果然是 UTF-8 和 UTF-16 编码不兼容的问题…… 我这里 r2 上看到的『恭喜发财』是 3*4 字节,也难怪了
不过不管怎么样,我觉得 Java 那个真的是有很大问题,比方说你这有个文件

echo -n NiHaoShiJie >helloworld
hexdump helloworld
如你所见肯定是 11 个字(char8, Ni Hao Shi Jie, 9+2)

可是你用 java.io.File 的输入流 API 一读
import java.io.File
val f = File("helloworld")
val fin = f.inputStream()
println(fin.read())

欸,怎么好像是我的问题……

我一直很奇怪为什么 Reader.InMemoryReader.File 在 readInt8, readChar16 的时候都会先弄出一 (-1) 一 (-2)....
糟了,好像连 java.io.RandomAccessFile 和 java.io.DataInputStream 都不会弄出这档子事…… 这世界是怎么了
Welcome to Kotlin version 1.2.51 (JRE 1.8.0_222-b10)
Type :help for help, :quit for quit
>>> import org.duangsuse.dokuss.*
>>> val r = Reader.File("helloworld")
>>> r.readInt8()
78
>>> r.readInt8()
105
emmm 怎么又好了?又没有这个 bug 了?readChar16 也正常???WTF????
This media is not supported in your browser
VIEW IN TELEGRAM
duangsuse::Echo
如果可能的话还想写点 Rust extern 和 unsafe 的内容呢... btw. (其实是完全无关的)想自动内存管理的时候突然想到 Xor 的 HexagonVM 使用了一个比较 trivial 的 naive dfs tracing GC,内存分配是基于 Rust std 类型的 https://github.com/losfair/hexagon/blob/master/src/object_pool.rs#L143 /// Run the garbage collector with…
let ROOT_STATICS = 0usize;
fun visit_child(&mut self, &mut dfs: Vec<usize>, id: usize) {
let prod = &self.objects[id].as_ref().unwrap().as_object();
dfs.push_all(prod.get_children());
}

pub fn collect(&mut self, stack: &CallStack) {
let mut id_alive = vec![false; self.objects.len()];
let mut dfs: Vec<usize> = Vec::new();
dfs.push(ROOT_STATICS);

dfs.push_all(stack.collect_objects());
while let Some(id) = dfs.pop() {
if id_alive[id] { continue }
id_alive[id] = true;
self.visit_child(dfs, id);
}

for id in id_visited {
if !self.objects[id].is_some() || id_alive[id]
|| self.objects[id].as_ref().unwrap().has_native_refs()
{ continue }

self.objects[id].as_ref().unwrap().gc_notify();
self.deallocate(i);
}
}

Rust 的写起来相信会难看许多,因为它首先要 lifetime……(或许,如果推断不出的话)
然后是,我不知道 push_all 什么的能不能用
self.objects 居然是 Indexable<Optional<ProdVal>>, 也是奇怪,欸不对,是 index 这个操作本身 partial function…… 所以 Optional
不过 Rust 还是有自己的风格,但是到处 .as_ref().unwrap().…… ,还不如写该写的……

fun collectGarbage() {
val visited: MutableSet<ProdVal> = mutableSetOf() //....
}