DevToys-app / DevToysMac

DevToys For mac
MIT License
9.24k stars 365 forks source link

Launch failed due to the execution of the previous regular expression test during the startup process. #144

Open syt2 opened 12 months ago

syt2 commented 12 months ago

I used the following regular expression:

\B\[[1-9][0-9]*\]\s+((((.*?){2},)*)+\s*)(["“\s].*?["”\s]){0}\s*.*[0-9]

and the following test text:

REFERENCES
[23] Jia Deng, Wei Dong, R. Socher, Li-Jia Li, Kai Li, and Li Fei-Fei, “ImageNet: A large-scale hierarchical image database,” in Computer Vision and Pattern Recognition (CVPR), 2009, pp. 248–255.
[24] KaimingHe,XiangyuZhang,ShaoqingRen,andJianSun,“Delving deep into rectifiers: Surpassing human-level performance on imagenet classification,” in International Conference on Computer Vision (ICCV), 2015, pp. 1026–1034.
[25] Drew Linsley, Dan Scheibler, Sven Eberhardt, and Thomas Serre, “Global-and-local attention networks for visual recognition,” CoRR,
abs/1805.08819, 2018. 5.
[26] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ra-
makrishna Vedantam, Devi Parikh, and Dhruv Batra, “Grad-CAM: Visual Explanations from Deep Networks via Gradient-Based Localization,” International Conference on Computer Vision (ICCV), pp. 336–359, 2017.
[27] Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun, “Shuf- fleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices,” Computer Vision and Pattern Recognition (CVPR), pp. 6848–6856, 2018.
[28] Alex Krizhevsky, “Learning Multiple Layers of Features from Tiny Images,” Technical report, University of Toronto, 2009.
[29] Tsung Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick, “Microsoft COCO: Common objects in context,” in European
Conference on Computer Vision (ECCV), 2014, pp. 740–755.
[30] Tsung Yi Lin, Piotr Dollár, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie, “Feature pyramid networks for
object detection,” in Computer Vision and Pattern Recognition (CVPR),
2017, pp. 936–944.
[31] Tsung Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr
Dollar, “Focal Loss for Dense Object Detection,” in International
Conference on Computer Vision (ICCV), 2017, pp. 2999–3007.
[32] Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson, “How transferable are features in deep neural networks?,” in Neural
Information Processing Systems (NIPS), 2014, pp. 3320–3328.
[33] Jian Hao Luo, Jianxin Wu, and Weiyao Lin, “ThiNet: A Filter Level Pruning Method for Deep Neural Network Compression,”
in International Conference on Computer Vision (ICCV), 2017, pp. 5068–5076.

It appears that the regular expression's matching complexity is too high, leading to a potential hang in the execution of the code found at the following link: https://github.com/ObuchiYuki/DevToysMac/blob/38d4160838721d7d2beae16a6b3235be5a7f4bb2/DevToys/DevToys/Body/Text/RegexTesterView%2B.swift#L52

Since this code is executed in the main thread, it results in the unresponsiveness of the application. Consequently, during the next launch, the application attempts to restore the previous regular expression matching, triggering the same problematic code execution and leading to a launch failure.

veler commented 5 months ago

Hi,

DevToysMac is now archived and deprecated. We just released DevToys 2.0 for Windows, Mac and Linux. This issue may or may have not been addressed in the new version. If the issue persist, we encourage to open a new issue on https://github.com/DevToys-app/DevToys or https://github.com/DevToys-app/DevToys.Tools

See more information about DevToys 2.0 here: https://devtoys.app/blog/announcing-devtoys-2.0-preview